Chromecast, an Android Device, and UMS.

Discuss media renderers like Xbox 360, TVs, smartphones, etc.
Einzeln
Posts: 9
Joined: Wed May 21, 2014 11:09 pm

Re: Chromecast, an Android Device, and UMS.

Post by Einzeln »

Do not use -filter_complex in the CustomFFmpegOptions. The place for it is the OverrideVideoFilter.
I'll take a look at that. Thank you.
On the other hand support for embedded subtitles is implemented in the UMS and propper subs can be chosen in the TRANSCODE folder or you have to set the Subtitles settings properly.
The problem with this is that UMS relies on mediainfo.dll to parse the file in order to properly utilize your preferred settings. But mediainfo returns null when calling from chromecast. Also, I can access the transcode folder and view all appropriate map sets for audio/subtitle implementation, but launching these for chromecast does nothing at all. UMS doesn't react to it in any way. Or at least there are no signs of anything happening as even debug.log does not change.
What's more your code will work only for picture based subs not for the text one.
This is true, unfortunately.
Wolfgan
Posts: 370
Joined: Fri Feb 08, 2013 12:33 am

Re: Chromecast, an Android Device, and UMS.

Post by Wolfgan »

valib wrote:Do not use -filter_complex in the CustomFFmpegOptions. The place for it is the OverrideVideoFilter.
Interesting, thx Valib. I tried to find documentation on OverrideVideoFilter but couldn't find any in PS3.conf or UMS.conf (and just a single reference in the github code in RendererConfiguration.java)

I'm trying to implement my video remux only machine as in viewtopic.php?f=4&t=1221#p10280 and trying different approaches. Do you think OverrideVideoFilter will work to that end? (or is it just a way to establish priority order for video filters?)
Thx, Wolf
-- UMS serving PS3, WDTV, Samsung H6400 + J5500 and Kalemsoft renderers! (no video transcoding but remuxing accepted :D )
Einzeln
Posts: 9
Joined: Wed May 21, 2014 11:09 pm

Re: Chromecast, an Android Device, and UMS.

Post by Einzeln »

BWAHAHAHAHAHA! Great success! I have found that my previous beliefs on how mediainfo.dll is utilized have been proven! As I said before, I had believed that the reason mediainfo was null for chromecast was that UMS had initialized mediainfo for the android client we browsed with but would not initialize for chromecast since chromecast does no browsing of the files and only asks for them. I had an epiphany while I was explaining this issue I've been working on to a friend. I essentially hacked chromecast.conf to be inclusive of the android user-agent header as well as the chromecast user-agent header. So to see what I'm talking about this is what you need to do:

Step 1. Start UMS
Step 2. Open the 'General Configuration' tab
Step 3. Click the 'Select renderers' button
Step 4. Deselect Android
Step 5. Click 'OK'
Step 6. Modify Chromecast.conf to this:

Code: Select all

#----------------------------------------------------------------------------
#Profile for Android/Chromecast.
#See PS3.conf for a description of all possible configuration options.
#

RendererName=Android/Chromecast
RendererIcon=android.png
UserAgentSearch=Android
UserAgentAdditionalHeader=User-Agent
UserAgentAdditionalHeaderSearch=CrKey

Video=true
Audio=true
Image=true
SeekByTime = true
TranscodeVideo = H264TSAC3
TranscodeAudio = MP3
MaxVideoBitrateMbps = 20
MimeTypesChanges = video/mpeg=video/mp4

MediaInfo = true
CreateDLNATreeFaster = true

Supported = f:bmp                  m:image/bmp
Supported = f:gif                  m:image/gif
Supported = f:jpg                  m:image/jpeg
Supported = f:png                  m:image/png

Supported = f:mp4   v:mp4|h264   a:aac|aac-he|mp3|ogg   m:video/mp4   n:2
Supported = f:webm   v:mp4|h264   a:aac|aac-he|mp3|ogg   m:video/mp4   n:2

Supported = f:mp3                  m:audio/mpeg   n:2

SupportedSubtitlesType = WEBVTT

CustomFFmpegOptions = -async 1 -fflags +genpts -c:v libx264 -profile:v high -level 4.1 -c:a libmp3lame -ac 2 -preset ultrafast -b:v 35000k -bufsize 35000k -f matroska
Step 7. Restart UMS
Step 8. Use LocalCast or equivalent app to browse for a video to play
Step 9. Play the video

Now, if you inspect the log you'll see that media info has returned all the appropriate information for the file. Better yet, if your file has multiple audio languages or subtitles they are now appropriately mapped. My CustomFFmpegOptions still encode the file into a chromecast compatible format so now I can officially say everything works! *except seeking which is still limited in support :( Here's the coolest part about this set up though. I used BubbleUpnp to browse UMS and play a video locally on my nexus 7. I found that full functionality still exists for Android as well! For those of you that understand what I did at the top of my .conf, I would say this is something of a hack to get around the problem but one that works remarkably well! For those of you that don't quite get what's been done, I'll explain.

UserAgentSearch searches all User-Agent headers for the indicated value 'Android' in this case. Then, UserAgentAdditionalHeader searches for all headers that start with the indicated value 'User-Agent' in this case. Finally, UserAgentAdditionalHeaderSearch searches the headers found by UserAgentAdditionalHeader for the indicated value 'CrKey' in this case. What this has done is when you browse UMS with your android device it sees it as the renderer 'Chromecast' and mediainfo is called to set up the files for appropriate mapping once your renderer calls for a file. But when you select a video to play with localcast or an equivalent app your real chromecast asks for it. This used to be a problem. However, now when chromecast sends its request header UMS finds "CrKey" inside the header "User-Agent" and says "Oh! This is an additional header for the Chromecast renderer" and decides it is the same kind of renderer. So UMS now knows it can use the same values for this renderer as what it set up for your other chromecast (android).

All together I'd say this could potentially be improved to actually support Android and Chromecast as different renderers. But for now, this absolutely WORKS!!!! BubbleUpnp still refuses to play files that aren't MP4s but I bet adding UseSameExtension=mp4 to my provided .conf will solve that. And if it does then BubbleUpnp would be my recommended client application to use since it supports playback from many servers to many clients including local playback and best of all it's free. Due to this set-up you don't have to set up the bubble server on your pc either because UMS does the transcoding. Finally, since it has some way that it parses duration on its own, it also has the best seeking support. I hope this helps some of you out with casting your media. Until next time!

Happy Casting!

Edit: So I was wrong about UseSameExtension. Bubble no longer cares about the extension and checks the mimetype only. But adding "MimeTypesChanges = video/mpeg=video/mp4" has fixed the problem. I've updated the code to reflect this and a couple of optimizations.
User avatar
DeFlanko
Posts: 724
Joined: Thu Jun 21, 2012 3:43 am
Location: San Pedro, CA
Contact:

Re: Chromecast, an Android Device, and UMS.

Post by DeFlanko »

I was so busy this weekened i didnt get a chance to test this.. ill get to testing it soon for sign off and close out of PR #300!
rudster
Posts: 1
Joined: Fri May 30, 2014 2:04 am

Re: Chromecast, an Android Device, and UMS.

Post by rudster »

Thank you so much Einzeln!!!! Your code and method works great!! Much appreciated :D
User avatar
DeFlanko
Posts: 724
Joined: Thu Jun 21, 2012 3:43 am
Location: San Pedro, CA
Contact:

Re: Chromecast, an Android Device, and UMS.

Post by DeFlanko »

Einzeln
Posts: 9
Joined: Wed May 21, 2014 11:09 pm

Re: Chromecast, an Android Device, and UMS.

Post by Einzeln »

@rudster No problem. I enjoyed making it work and I'm glad you enjoy it working! :D
Post Reply