heksesang 10 Posted February 17, 2016 Posted February 17, 2016 I recently started using the Windows 10 app for playing media from my Emby server (on the same local network). And when I play content with H.264 and AC-3 with text-based subtitles, it direct plays just fine. But the moment I try to play a file which includes DTS/DTS-HD/TRUEHD audio, or image-based subtitles like PGS, the server transcodes the content. Take the scenario that I have Brave, with a H.264 video track, both TrueHD and AC-3 audio tracks, and PGS subtitles: General Unique ID : 276614881112400676784487498428055093030 (0xD01A169830DE8463D3893E409988FF26) Complete name : F:\Brave (2012).mkv Format : Matroska Format version : Version 2 File size : 9.23 GiB Duration : 1h 33mn Overall bit rate mode : Variable Overall bit rate : 14.1 Mbps Movie name : Brave Writing application : Lavf55.8.102 Writing library : Lavf55.8.102 Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4 Format settings, CABAC : Yes Format settings, ReFrames : 4 frames Codec ID : V_MPEG4/ISO/AVC Duration : 1h 33mn Width : 1 920 pixels Height : 800 pixels Display aspect ratio : 2.40:1 Frame rate mode : Constant Frame rate : 23.976 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Writing library : x264 core 133 r2334 a3ac64b Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=19.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 Language : English Default : No Forced : No Audio #1 ID : 2 Format : TrueHD Codec ID : A_TRUEHD Duration : 1h 33mn Bit rate mode : Variable Maximum bit rate : 8 373 Kbps Channel(s) : 8 channels Channel positions : Front: L C R, Side: L R, Back: L R, LFE Sampling rate : 48.0 KHz Bit depth : 24 bits Compression mode : Lossless Title : 7.1 Language : English Default : Yes Forced : No Audio #2 ID : 3 Format : AC-3 Format/Info : Audio Coding 3 Mode extension : CM (complete main) Format settings, Endianness : Big Codec ID : A_AC3 Duration : 1h 33mn Bit rate mode : Constant Bit rate : 640 Kbps Channel(s) : 6 channels Channel positions : Front: L C R, Side: L R, LFE Sampling rate : 48.0 KHz Compression mode : Lossy Stream size : 429 MiB (5%) Title : 3/2+1 Language : English Default : No Forced : No Audio #3 ID : 4 Format : AC-3 Format/Info : Audio Coding 3 Mode extension : CM (complete main) Format settings, Endianness : Big Codec ID : A_AC3 Duration : 1h 33mn Bit rate mode : Constant Bit rate : 640 Kbps Channel(s) : 6 channels Channel positions : Front: L C R, Side: L R, LFE Sampling rate : 48.0 KHz Compression mode : Lossy Stream size : 429 MiB (5%) Title : 3/2+1 Language : Swedish Default : No Forced : No Audio #4 ID : 5 Format : AC-3 Format/Info : Audio Coding 3 Mode extension : CM (complete main) Format settings, Endianness : Big Codec ID : A_AC3 Duration : 1h 33mn Bit rate mode : Constant Bit rate : 640 Kbps Channel(s) : 6 channels Channel positions : Front: L C R, Side: L R, LFE Sampling rate : 48.0 KHz Compression mode : Lossy Stream size : 429 MiB (5%) Title : 3/2+1 Language : Norwegian Default : No Forced : No Audio #5 ID : 6 Format : AC-3 Format/Info : Audio Coding 3 Mode extension : CM (complete main) Format settings, Endianness : Big Codec ID : A_AC3 Duration : 1h 33mn Bit rate mode : Constant Bit rate : 640 Kbps Channel(s) : 6 channels Channel positions : Front: L C R, Side: L R, LFE Sampling rate : 48.0 KHz Compression mode : Lossy Stream size : 429 MiB (5%) Title : 3/2+1 Language : Danish Default : No Forced : No Audio #6 ID : 7 Format : AC-3 Format/Info : Audio Coding 3 Mode extension : CM (complete main) Format settings, Endianness : Big Codec ID : A_AC3 Duration : 1h 33mn Bit rate mode : Constant Bit rate : 640 Kbps Channel(s) : 6 channels Channel positions : Front: L C R, Side: L R, LFE Sampling rate : 48.0 KHz Compression mode : Lossy Stream size : 429 MiB (5%) Title : 3/2+1 Language : Finnish Default : No Forced : No Text #1 ID : 8 Format : PGS Codec ID : S_HDMV/PGS Codec ID/Info : Picture based subtitle format used on BDs/HD-DVDs Title : SDH Language : English Default : No Forced : No Text #2 ID : 9 Format : PGS Codec ID : S_HDMV/PGS Codec ID/Info : Picture based subtitle format used on BDs/HD-DVDs Language : Swedish Default : No Forced : No Text #3 ID : 10 Format : PGS Codec ID : S_HDMV/PGS Codec ID/Info : Picture based subtitle format used on BDs/HD-DVDs Language : Norwegian Default : No Forced : No Text #4 ID : 11 Format : PGS Codec ID : S_HDMV/PGS Codec ID/Info : Picture based subtitle format used on BDs/HD-DVDs Language : Danish Default : No Forced : No Text #5 ID : 12 Format : PGS Codec ID : S_HDMV/PGS Codec ID/Info : Picture based subtitle format used on BDs/HD-DVDs Language : Finnish Default : No Forced : No To transcode this, the server should be able to use the options -c:v:0 copy -c:a:0 copy -map 0:v:0 -0:a:1 to create the chunk, but for some reason I see it set -c:v:0 libx264 and -c:a:0 aac and re-encode the video and audio. Even if it did re-encode the audio, I don't see why it should re-encode the video as well as long as it doesn't need to burn in the PGS subtitles. Also, it should be able to just use the AC-3 track instead of re-encoding the TrueHD if TrueHD isn't supported. Is this a limitation in the server, or does the app do something wrong when it requests the stream?
Redshirt 1487 Posted February 17, 2016 Posted February 17, 2016 When it comes to subtitles, the server makes it's decisions based on what the users subtitle settings are set to in the server dashboard. I've set my subtitles to off so their presence is never factored into the stream selection / url generation process. If I want subtitles it's easier to enable them from the video player and then the server can transcode if necessary.
heksesang 10 Posted February 17, 2016 Author Posted February 17, 2016 When it comes to subtitles, the server makes it's decisions based on what the users subtitle settings are set to in the server dashboard. I've set my subtitles to off so their presence is never factored into the stream selection / url generation process. If I want subtitles it's easier to enable them from the video player and then the server can transcode if necessary. If you deselect subtitles in the player, it should go back to just direct copy the H.264 stream. No reason to re-encode anymore then. But at least with the Windows 10 app, it seems that it decides to re-encode just based on whether the unsupported audio/subtitle formats are in the file at all.
Deathsquirrel 745 Posted February 17, 2016 Posted February 17, 2016 With the audio track are you selecting the supported track? I haven't tested it but I would expect it to stop transcoding audio if I select a track in a supported format.
heksesang 10 Posted February 17, 2016 Author Posted February 17, 2016 With the audio track are you selecting the supported track? I haven't tested it but I would expect it to stop transcoding audio if I select a track in a supported format. I expected that too, but the behaviour doesn't seem to change unless I actually remove the tracks from the file itself. Also re-ordering the tracks in the file with ffmpeg doesn't seem to do anything to change it.
heksesang 10 Posted February 17, 2016 Author Posted February 17, 2016 So, I tested something else, I took this file and turned it into an MP4 with the same tracks: General Unique ID : 89432882167519152638190006186259428372 (0x43482586218F3CF3041E46D33E56B414) Complete name : F:\Movies\Sherlock Holmes - A Game of Shadows (2011)\Sherlock Holmes - A Game of Shadows (2011).mkv Format : Matroska Format version : Version 2 File size : 4.00 GiB Duration : 2h 8mn Overall bit rate : 4 449 Kbps Movie name : Sherlock Holmes: A Game of Shadows Writing application : Lavf55.8.102 Writing library : Lavf55.8.102 SYNOPSIS : Robert Downey Jr. reprises his role as the world's most famous detective, Sherlock Holmes, and Jude Law returns as his friend and colleague, Dr. John Watson, in "Sherlock Holmes: A Game of Shadows." There is a new criminal mastermind at large-Professor James Moriarty (Jared Harris)-and not only is he Holmes' intellectual equal, but his capacity for evil, coupled with a complete lack of conscience, may give him an advantage over the renowned detective. Holmes' investigation into Moriarty's plot becomes more dangerous as it leads him and Watson out of London to France, Germany and finally Switzerland. But the cunning Moriarty is always one step ahead, and moving perilously close to completing his ominous plan. If he succeeds, it will not only bring him immense wealth and power but alter the course of history. ARTIST : Guy Ritchie GENRE : Action & Adventure GAPLESS_PLAYBACK : 0 DATE : 2013-03-19T07:00:00Z COPYRIGHT : 2011 WARNER BROS. ENTERTAINMENT INC. – U.S., CANADA, BAHAMAS & BERMUDA © 2011 VILLAGE ROADSHOW FILMS (BVI) LIMITED – ALL OTHER TERRITORIES DESCRIPTION : Robert Downey Jr. reprises his role as the world's most famous detective, Sherlock Holmes, and Jude Law returns as his friend and colleague, Dr. John Watson, in "Sherlock Holmes: A Game of Shadows." There is a new criminal mastermind at large-Professor Ja HD_VIDEO : 2 MEDIA_TYPE : 9 Video ID : 2 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4 Format settings, CABAC : Yes Format settings, ReFrames : 5 frames Codec ID : V_MPEG4/ISO/AVC Duration : 2h 8mn Width : 1 916 pixels Height : 796 pixels Display aspect ratio : 2.40:1 Frame rate mode : Constant Frame rate : 23.976 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Language : English Default : Yes Forced : No Encoded date : UTC 2012-05-15 09:57:11 Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709 HANDLER_NAME : Apple Video Media Handler Audio #1 ID : 1 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : A_AAC Duration : 2h 8mn Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz Compression mode : Lossy Language : English Default : Yes Forced : No Encoded date : UTC 2012-05-15 09:57:11 HANDLER_NAME : Apple Sound Media Handler Audio #2 ID : 3 Format : AC-3 Format/Info : Audio Coding 3 Mode extension : CM (complete main) Format settings, Endianness : Big Codec ID : A_AC3 Duration : 2h 8mn Bit rate mode : Constant Bit rate : 384 Kbps Channel(s) : 6 channels Channel positions : Front: L C R, Side: L R, LFE Sampling rate : 48.0 KHz Bit depth : 16 bits Compression mode : Lossy Stream size : 354 MiB (9%) Language : English Default : Yes Forced : No Encoded date : UTC 2012-05-15 09:57:11 HANDLER_NAME : Apple Sound Media Handler Menu 00:00:00.000 : :Chapter 1. 00:09:15.000 : :Chapter 2. 00:19:34.000 : :Chapter 3. 00:30:43.000 : :Chapter 4. 00:40:09.000 : :Chapter 5. 00:50:24.000 : :Chapter 6. 00:59:39.000 : :Chapter 7. 01:09:14.000 : :Chapter 8. 01:18:51.000 : :Chapter 9. 01:30:01.000 : :Chapter 10. 01:39:00.000 : :Chapter 11. 01:49:41.000 : :Chapter 12. 02:00:15.000 : :Chapter 13. Then I made a HTML file with a <video> tag, setting my new MP4 file as src, and trying to open it in Edge. It plays just fine. Yet when I play the same movie from Emby, in Edge, it re-encodes the video and audio (using -c:v:0 libx264 and -c:a:0 ac3 as parameters to ffmpeg, according to the logs). So, everything points in the direction of this being a server issue.
heksesang 10 Posted February 17, 2016 Author Posted February 17, 2016 So, it seems if it's an MP4, Edge direct plays it. If it's the wrong container, this case an MKV, instead of simple remuxing the streams into a new container, it seems to re-encode all the streams. Any devs who can shed some light on this? Is the code simply just re-encoding everything as soon as it cannot direct play the content, without taking into consideration whether the streams are already in a compatible format?
Luke 42080 Posted February 17, 2016 Posted February 17, 2016 if you would like remuxing then use chrome. it has additional format support that makes it more feasible.
Redshirt 1487 Posted February 17, 2016 Posted February 17, 2016 Luke, he's using the w10 app. He just did that test in edge so he could manipulate the URL.
heksesang 10 Posted February 18, 2016 Author Posted February 18, 2016 (edited) if you would like remuxing then use chrome. it has additional format support that makes it more feasible. I just want direct streaming of my content to the W10 app. So I am trying to figure out where the problem lies, as I only get direct streaming with the files that have supported content. It seems that with Chrome, it doesn't invoke ffmpeg at all. I assume that is because Chrome has MKV support or something. But, why isn't the server doing direct copy with ffmpeg when the client doesn't support the container? If an MKV file has a H.264 stream and an AAC track, and you're gonna stream this to a browser, why not remux it into an MP4 with ffmpeg? With -c copy as the codec parameter? It would save a ton of CPU power. And that is just an example, the same goes for any client. It seems to always re-encode when a simple remux with -c copy would do the trick. Both for the web client and the W10 app. Edited February 18, 2016 by heksesang
Luke 42080 Posted February 18, 2016 Posted February 18, 2016 Yea chrome supports mkv which affords a lot of additional flexibility. mp4 is not as simple as you might think. the container is not designed for content created on the fly, it's really meant for pre-made files. In order to convert to mp4 on the fly we have to use a technique called fragmented mp4, and most players don't handle that very well, including the browser-based players.
Vicpa 611 Posted February 18, 2016 Posted February 18, 2016 (edited) Hi @@heksesang Just to clarify for you. The win 10 app. Which I believe is the subject of your op. Directs plays the following formats/ containers natively <DirectPlayProfile container="mp4,mov" audioCodec="aac,ac3,eac3,mp3,pcm" videoCodec="h264,mpeg4" type="Video" /> <DirectPlayProfile container="ts" audioCodec="aac,ac3,eac3,mp3,mp2,pcm" videoCodec="h264" type="Video" /> <DirectPlayProfile container="mkv" audioCodec="aac,ac3,eac3,mp3,mp2,pcm,pcm_s16le,pcm_s24le" videoCodec="h264,hevc" type="Video" /> <DirectPlayProfile container="asf" audioCodec="wmav2,wmapro,wmavoice" videoCodec="wmv2,wmv3,vc1" type="Video" /> <DirectPlayProfile container="avi" audioCodec="mp3,ac3,eac3,mp2,pcm" videoCodec="mpeg4,msmpeg4,mjpeg,h264" type="Video" /> <DirectPlayProfile container="mp4" audioCodec="aac,alac" type="Audio" /> <DirectPlayProfile container="mp3" audioCodec="mp3" type="Audio" /> <DirectPlayProfile container="m4a" audioCodec="aac" videoCodec="" type="Audio" /> <DirectPlayProfile container="flac" audioCodec="flac" videoCodec="" type="Audio" /> <DirectPlayProfile container="wma" audioCodec="wmav2,wmapro,wmavoice" videoCodec="" type="Audio" /> <DirectPlayProfile container="jpeg" type="Photo" /> l So pretty much everything except DTS. and mpeg2video(this may change soon!) I am not real familiar with external subtitles. After that point the server will decide on how it wants to transcode. The one tweak you can make is to pick the default audio format in C:\Users\XXXXX\AppData\Local\Packages\436337Illusions.com.MediaBrowser_77hd5e1v1hqs4\LocalState there is an xml file StreamingProfile.xml in there you will find entries like. The first audio codec is the default for transcode (see red highlight) <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac,eac3,ac3" protocol="hls" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" /> I have changed mine to "ac3,acc,eac3". The server generally does a copy of the video if it can but will transcode audio even if it could to a copy. The segmented mp4 crap is referring to Adaptive Streaming There are two flavors HLS and MS's HLS is the steaming format originally developed by Apple and uses .ts chunks. and an m3u8 file. That is what the Win 10 app uses. MS has seen the light and included native support of HLS in Win 10 as well. Can't speak to Edge but chunked mp4 files should use a manifest file vs m3u8 if it that is what is really being done, but that is not your question anyway. There is some disagreement as to whether HLS audio copy is "stable enough for the masses." Bottom line I rip my content to mp4 or MKV with a AC3 audio track and whatever the original is if it is not supported. For example. orig audio ac3 or eac3 - good to go orig DTS DTS-MA etc. AC3 + DTS etc I use handbrake sure other are similar best combo I have found is bit rate 448 and channels same as orig. Ac3 5.1 will play on any win 10,8 device so there is no need to dumb it down to acc or fewer channels. Hope this helps -vicpa Bottom line I have found transcoding to be a bad thing Edited February 18, 2016 by Vicpa
anderbytes 141 Posted February 18, 2016 Posted February 18, 2016 Yea chrome supports mkv which affords a lot of additional flexibility. mp4 is not as simple as you might think. the container is not designed for content created on the fly, it's really meant for pre-made files. In order to convert to mp4 on the fly we have to use a technique called fragmented mp4, and most players don't handle that very well, including the browser-based players. One more for the list of "Tips we might never know". I always used Firefox and never thought it would make a difference from other browsers...
heksesang 10 Posted February 18, 2016 Author Posted February 18, 2016 Hi @@heksesang Just to clarify for you. The win 10 app. Which I believe is the subject of your op. Directs plays the following formats/ containers natively <DirectPlayProfile container="mp4,mov" audioCodec="aac,ac3,eac3,mp3,pcm" videoCodec="h264,mpeg4" type="Video" /> <DirectPlayProfile container="ts" audioCodec="aac,ac3,eac3,mp3,mp2,pcm" videoCodec="h264" type="Video" /> <DirectPlayProfile container="mkv" audioCodec="aac,ac3,eac3,mp3,mp2,pcm,pcm_s16le,pcm_s24le" videoCodec="h264,hevc" type="Video" /> <DirectPlayProfile container="asf" audioCodec="wmav2,wmapro,wmavoice" videoCodec="wmv2,wmv3,vc1" type="Video" /> <DirectPlayProfile container="avi" audioCodec="mp3,ac3,eac3,mp2,pcm" videoCodec="mpeg4,msmpeg4,mjpeg,h264" type="Video" /> <DirectPlayProfile container="mp4" audioCodec="aac,alac" type="Audio" /> <DirectPlayProfile container="mp3" audioCodec="mp3" type="Audio" /> <DirectPlayProfile container="m4a" audioCodec="aac" videoCodec="" type="Audio" /> <DirectPlayProfile container="flac" audioCodec="flac" videoCodec="" type="Audio" /> <DirectPlayProfile container="wma" audioCodec="wmav2,wmapro,wmavoice" videoCodec="" type="Audio" /> <DirectPlayProfile container="jpeg" type="Photo" /> l So pretty much everything except DTS. and mpeg2video(this may change soon!) I am not real familiar with external subtitles. After that point the server will decide on how it wants to transcode. The one tweak you can make is to pick the default audio format in C:\Users\XXXXX\AppData\Local\Packages\436337Illusions.com.MediaBrowser_77hd5e1v1hqs4\LocalState there is an xml file StreamingProfile.xml in there you will find entries like. The first audio codec is the default for transcode (see red highlight) <TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac,eac3,ac3" protocol="hls" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" /> I have changed mine to "ac3,acc,eac3". The server generally does a copy of the video if it can but will transcode audio even if it could to a copy. The segmented mp4 crap is referring to Adaptive Streaming There are two flavors HLS and MS's HLS is the steaming format originally developed by Apple and uses .ts chunks. and an m3u8 file. That is what the Win 10 app uses. MS has seen the light and included native support of HLS in Win 10 as well. Can't speak to Edge but chunked mp4 files should use a manifest file vs m3u8 if it that is what is really being done, but that is not your question anyway. There is some disagreement as to whether HLS audio copy is "stable enough for the masses." Bottom line I rip my content to mp4 or MKV with a AC3 audio track and whatever the original is if it is not supported. For example. orig audio ac3 or eac3 - good to go orig DTS DTS-MA etc. AC3 + DTS etc I use handbrake sure other are similar best combo I have found is bit rate 448 and channels same as orig. Ac3 5.1 will play on any win 10,8 device so there is no need to dumb it down to acc or fewer channels. Hope this helps -vicpa Bottom line I have found transcoding to be a bad thing Setting AC-3 in the transcoding profile doesn't make it do a copy, though. And even if I have an AC-3 track, which it can play natively, and there is a TrueHD track or DTS track which it can't play natively, it will transcode that track instead of just playing it with the AC-3 track that is there already. The H.264 video is always re-encoded and not copied, if it has to do a transcode. As I said, I have never seen it actually set -c:v:0 copy in the ffmpeg command line in the logs (which is how you make ffmpeg copy and not re-encode).
Vicpa 611 Posted February 18, 2016 Posted February 18, 2016 (edited) Setting AC-3 in the transcoding profile doesn't make it do a copy, though. And even if I have an AC-3 track, which it can play natively, and there is a TrueHD track or DTS track which it can't play natively, it will transcode that track instead of just playing it with the AC-3 track that is there already. The H.264 video is always re-encoded and not copied, if it has to do a transcode. As I said, I have never seen it actually set -c:v:0 copy in the ffmpeg command line in the logs (which is how you make ffmpeg copy and not re-encode). Hi Perhaps you have something else going on. This plays directly for me. You won't see any transcode log, because it is not transcoding. AC3 is the default audio track, perhaps that is the difference. I don't believe the app/server is smart enough yet to skip to a natively playing track. Settings in the profile only come into play when the app is forced to transcode. -vicpa Edited February 18, 2016 by Vicpa
heksesang 10 Posted February 18, 2016 Author Posted February 18, 2016 (edited) Hi Perhaps you have something else going on. This plays directly for me. You won't see any transcode log, because it is not transcoding. AC3 is the default audio track, perhaps that is the difference. I don't believe the app/server is smart enough yet to skip to a natively playing track. Settings in the profile only come into play when the app is forced to transcode. -vicpa Okay, you seem to have achieved what I want. How does it determine the default track? Is that a flag for the track, or is it depending on track order? EDIT: And if the app can play it directly as long as the default tracks are set to native formats, I am guessing it's an app problem and not a server problem. Edited February 18, 2016 by heksesang
Luke 42080 Posted February 18, 2016 Posted February 18, 2016 One more for the list of "Tips we might never know". I always used Firefox and never thought it would make a difference from other browsers... Chrome has more features thus it will always be able to do some things the other browsers can't do.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now