Chromecast, an Android Device, and UMS.

Discuss media renderers like Xbox 360, TVs, smartphones, etc.
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 » Sat Apr 26, 2014 3:01 am

sorry im double-checking now.

EDIT: Yes the build i have there does contain the CONF files needed for Avia and Chromecast

Ohmnibus
Posts: 1
Joined: Sun May 04, 2014 1:31 am

Re: Chromecast, an Android Device, and UMS.

Post by Ohmnibus » Sun May 04, 2014 1:38 am

I chose the Avia App because its the only one I have found to have the ability to do DNLA/UPnP and Cast without installing server side software.

If you have another app that can do this please mention it here, and ill see what i can do to make it work.
It seems that even LocalCast is now able to connect via DNLA/UPnP, and is free (with AD - lot of them, to be honest).

https://play.google.com/store/apps/deta ... .localcast

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 » Sat May 10, 2014 3:18 am

Ohmnibus wrote:
I chose the Avia App because its the only one I have found to have the ability to do DNLA/UPnP and Cast without installing server side software.

If you have another app that can do this please mention it here, and ill see what i can do to make it work.
It seems that even LocalCast is now able to connect via DNLA/UPnP, and is free (with AD - lot of them, to be honest).

https://play.google.com/store/apps/deta ... .localcast
Ill check it out.

hodejeger
Posts: 1
Joined: Mon May 12, 2014 9:51 pm

Re: Chromecast, an Android Device, and UMS.

Post by hodejeger » Mon May 12, 2014 9:59 pm

I am struggling with the same issue. I have tried avis, localcast (full ver), but no luck. UMS is not transcoding the video and sound to the right format. It should bwe possible by editing / making a good profile. I have done it berøre on the PMS for other equipment but dont have a clue now,,

Last week I tried the test Chromecast UMS versjon, but Chromecast replied with not knowing the format og the stream...

Any thoughts?


Best regards
Geir

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 » Tue May 13, 2014 3:02 am

I'm still fine tuning the CONF file... stay tuned =)

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

Re: Chromecast, an Android Device, and UMS.

Post by Einzeln » Thu May 22, 2014 12:27 am

Hi all,
I have made great progress with casting from UMS and thought I'd share my findings with everyone. Here is my configuration:

Code: Select all

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

RendererName=ChromeCast
RendererIcon=chromecast.png
UserAgentSearch=CrKey

Video=true
Audio=true
Image=true

# Allcast moves forward in 30 second increments and this works when casting from UMS, like-wise seeking works with BubbleUpnp
SeekByTime = true

# TranscodeVideo isn't really necessary but is here for good measure.
TranscodeVideo = H264TSAC3
TranscodeAudio = MP3

#BubbleUpnp won't work without this since it performs its own compatibility check when attempting a cast. If you experience problems using other casting services, maybe commenting this out will help.
UseSameExtension = mp4

#Sometimes this value seems to be ignored but I left it in case it works. Increase it if you like. I usually don't see problems past 45 Mbps.
MaxVideoBitrateMbps = 20

#These values don't seem to matter with this configuration.
MediaInfo = 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

# This is the important part:
# (Make video work) -map 0:v which maps the first video stream. -c:v through -level ensure the video stream is encoded properly for chromecast.
# (Make audio work) -map 0:a maps the first audio stream. -c:a and -ac encode audio for casting.
# (Prevent stutter due to slow encoding) -preset ultrafast helps your processor encode the video as quickly as possible. if your processor is fast enough try increasing this. I expect you might get better quality out of your limited bitrate.
# (Prevent stutter due to slow connection) -b:v and -buffsize should ensure the encoded video does not exceed a bitrate that can fit through a wifi connection. These sometimes seem to be ignored in the same way MaxVideoBitrateMBPS does.
# (output) -f matroska, I know chromecast doesn't support mkv. But webm is basically a dumbed down mkv so this works. using mp4 instead has given me problems for some reason.
CustomFFmpegOptions = -async 1 -fflags +genpts -map 0:v -c:v libx264 -profile:v high -level 4.1 -map 0:a -c:a libmp3lame -ac 2 -preset ultrafast -b:v 35000k -bufsize 35000k -f matroska
So with this .conf I have been able to throw every combination of containers and codecs I have at the chromecast without any playback issues. In short, this works! However, there are still some issues.

1. language selection: the problem is that my configuration assuredly maps the first audio stream in the file. However, this isn't necessarily the language set as preferred in your UMS settings. UMS normally uses MediaInfo.dll to parse the file and map audio and subtitles according to your settings. The reason this doesn't happen with my .conf is that, for some reason, mediainfo always returns null when playing to chromecast.

2. subtitles: what can I say, chromecast has issues with subtitles. But UMS would usually bypass this quite easily. UMS will typically burn-in subtitles after encoding them to a temporary external .ass file. This happens during the transcode, when necessary based on your settings. But once again since mediainfo returns null UMS doesn't set this up.

3. seeking: the above configuration actually doesn't have much to do with this but seeking actually does work for Allcast and BubbleUpnp. I can't get it to work for localcast though. The reason for this is that localcast seems to use a ratio based on duration. duration is retrieved by (did you guess it?) mediainfo, which returns null for this value as well. Allcast doesn't care about duration and just seeks by time in 30 second increments so this works. BubbleUpnp somehow grabs duration itself. (in the log, duration is still null but Bubble gets the right value regardless) So seeking works here too.

Okay so to recap the main points are thus.
The good:
-This configuration will play your file limited only by the capabilities of ffmpeg. (on that note, make sure ffmpeg is at the top of the transcode list, lest nothing work)
The bad:
-There will be no subtitles
-Audio may not be your preferred language.
-Seeking support is limited.

I decided to post this because I felt like this is good enough for most viewers. Sorry if you like soft-subbed anime or anything of that sort, I'm still working to fix this. Many of you seem to use Avia. Sorry again, I can't guarantee compatibility as I haven't used it for testing. Also, maybe this will help others to help me solve the mediainfo issue. I feel like fixing this would solve most of the remaining problems.

As a final note to everyone who is trying to get this working, android.conf actually works in tandem with chromecast.conf when casting. The effects android.conf has on casting seem pretty ambiguous. But a simple test of making android.conf match the above chromecast.conf and then playing locally on my nexus7 proved to have made everything work on my android viewing in exactly the way I wish it would for casting. But leaving android.conf like that then trying to cast causes problems. If you're going to mess with android.conf, make sure to make a backup because its effects are pretty unpredictable.

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 » Thu May 22, 2014 1:53 am

Einzeln wrote:Hi all,
I have made great progress with casting from UMS and thought I'd share my findings with everyone. Here is my configuration:

Code: Select all

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

RendererName=ChromeCast
RendererIcon=chromecast.png
UserAgentSearch=CrKey

Video=true
Audio=true
Image=true

# Allcast moves forward in 30 second increments and this works when casting from UMS, like-wise seeking works with BubbleUpnp
SeekByTime = true

# TranscodeVideo isn't really necessary but is here for good measure.
TranscodeVideo = H264TSAC3
TranscodeAudio = MP3

#BubbleUpnp won't work without this since it performs its own compatibility check when attempting a cast. If you experience problems using other casting services, maybe commenting this out will help.
UseSameExtension = mp4

#Sometimes this value seems to be ignored but I left it in case it works. Increase it if you like. I usually don't see problems past 45 Mbps.
MaxVideoBitrateMbps = 20

#These values don't seem to matter with this configuration.
MediaInfo = 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

# This is the important part:
# (Make video work) -map 0:v which maps the first video stream. -c:v through -level ensure the video stream is encoded properly for chromecast.
# (Make audio work) -map 0:a maps the first audio stream. -c:a and -ac encode audio for casting.
# (Prevent stutter due to slow encoding) -preset ultrafast helps your processor encode the video as quickly as possible. if your processor is fast enough try increasing this. I expect you might get better quality out of your limited bitrate.
# (Prevent stutter due to slow connection) -b:v and -buffsize should ensure the encoded video does not exceed a bitrate that can fit through a wifi connection. These sometimes seem to be ignored in the same way MaxVideoBitrateMBPS does.
# (output) -f matroska, I know chromecast doesn't support mkv. But webm is basically a dumbed down mkv so this works. using mp4 instead has given me problems for some reason.
CustomFFmpegOptions = -async 1 -fflags +genpts -map 0:v -c:v libx264 -profile:v high -level 4.1 -map 0:a -c:a libmp3lame -ac 2 -preset ultrafast -b:v 35000k -bufsize 35000k -f matroska
So with this .conf I have been able to throw every combination of containers and codecs I have at the chromecast without any playback issues. In short, this works! However, there are still some issues.

1. language selection: the problem is that my configuration assuredly maps the first audio stream in the file. However, this isn't necessarily the language set as preferred in your UMS settings. UMS normally uses MediaInfo.dll to parse the file and map audio and subtitles according to your settings. The reason this doesn't happen with my .conf is that, for some reason, mediainfo always returns null when playing to chromecast.

2. subtitles: what can I say, chromecast has issues with subtitles. But UMS would usually bypass this quite easily. UMS will typically burn-in subtitles after encoding them to a temporary external .ass file. This happens during the transcode, when necessary based on your settings. But once again since mediainfo returns null UMS doesn't set this up.

3. seeking: the above configuration actually doesn't have much to do with this but seeking actually does work for Allcast and BubbleUpnp. I can't get it to work for localcast though. The reason for this is that localcast seems to use a ratio based on duration. duration is retrieved by (did you guess it?) mediainfo, which returns null for this value as well. Allcast doesn't care about duration and just seeks by time in 30 second increments so this works. BubbleUpnp somehow grabs duration itself. (in the log, duration is still null but Bubble gets the right value regardless) So seeking works here too.

Okay so to recap the main points are thus.
The good:
-This configuration will play your file limited only by the capabilities of ffmpeg. (on that note, make sure ffmpeg is at the top of the transcode list, lest nothing work)
The bad:
-There will be no subtitles
-Audio may not be your preferred language.
-Seeking support is limited.

I decided to post this because I felt like this is good enough for most viewers. Sorry if you like soft-subbed anime or anything of that sort, I'm still working to fix this. Many of you seem to use Avia. Sorry again, I can't guarantee compatibility as I haven't used it for testing. Also, maybe this will help others to help me solve the mediainfo issue. I feel like fixing this would solve most of the remaining problems.

As a final note to everyone who is trying to get this working, android.conf actually works in tandem with chromecast.conf when casting. The effects android.conf has on casting seem pretty ambiguous. But a simple test of making android.conf match the above chromecast.conf and then playing locally on my nexus7 proved to have made everything work on my android viewing in exactly the way I wish it would for casting. But leaving android.conf like that then trying to cast causes problems. If you're going to mess with android.conf, make sure to make a backup because its effects are pretty unpredictable.

Fantastic notes... Ill for sure test this in my configuration! THANKS! Excellent work good job!

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

Re: Chromecast, an Android Device, and UMS.

Post by Einzeln » Thu May 22, 2014 9:13 am

I'm sorry. I made a mistake in the .conf I posted earlier. I put UseSameExtension in and explained why it's there but actually UseSameExtension isn't necessary for chromecast.conf and needs to be put in android.conf to make BubbleUpnp work. I think this shouldn't have caused you any trouble though and hope it didn't.

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

Re: Chromecast, an Android Device, and UMS.

Post by Einzeln » Sat May 24, 2014 9:18 pm

Hello again all,
I've found a way to get embedded subtitles working.

Code: Select all

CustomFFmpegOptions = -async 1 -fflags +genpts -filter_complex "[0:v][0:s]overlay[vid]" -map "[vid]" -c:v libx264 -profile:v high -level 4.1 -map 0:a -c:a libmp3lame -ac 2 -preset ultrafast -b:v 35000k -bufsize 35000k -f matroska
Use of this will hardcode subs so they will show on your renderer. But here's the catch. It will break playback of files that do not have subs. And of course this burns in the first subtitle stream so files with multiple streams may not display your preferred language. So far I've been getting around the language issues by manually editing chromecast.conf with things like changing 0:s to 0:s:1 or 0:a to 0:a:1 for each particular file. This works, but it's a pain and you must restart UMS every time you make a change.

Also, I have begun to zero in on why MediaInfo has been returning null for chromecast. After much testing, it seems there are 4 things necessary for a successful call to mediainfo.
1. The file must be transcoded
2. MediaInfo=true must be present in the .conf
3. CreateDLNATreeFaster=true must be present in the .conf (I was wrong about this)
4. Your renderer must browse through your server so CreateDLNATree can 'initialize' the files.

The first point is no problem as avoiding the use of StreamExtensions should transcode things as necessary. The second and third points also have given me no trouble including them in chromecast.conf so long as I haven't done something to break it in android.conf. So where chromecast is getting hung up is on the fourth point. This is because, if you include CreateDLNATree in your android.conf then as you browse though your server on your android device everything may get initialized just fine and be ready to use mediainfo as soon as your android device calls up a file. But that's just it. Your android device never calls for any files. It merely passes the 'address' to chromecast which makes the call itself. So chromecast has yet to see any DLNA tree, it just immediately teleports to the file it needs. I can't say for sure if this is what's happening but I'm confident in the evidence. Unfortunately, this would mean the only way to make chromecast work is for one of the developers to create a special method just for chromecast that would run mediainfo in a manner that works for chromecast. I've looked into getting around this with CustomMencoderOptions but limitations have been placed on encoding. Likewise, FFmpeg has limitations as to what it can parse from a file.
Last edited by Einzeln on Tue May 27, 2014 9:31 pm, edited 1 time in total.

User avatar
valib
Developer
Posts: 665
Joined: Fri Feb 08, 2013 3:11 am

Re: Chromecast, an Android Device, and UMS.

Post by valib » Sun May 25, 2014 8:58 am

Do not use -filter_complex in the CustomFFmpegOptions. The place for it is the OverrideVideoFilter. 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. Explanation is here http://www.universalmediaserver.com/faq/#Video3. What's more your code will work only for picture based subs not for the text one.

Post Reply