Jump to content

webm file with multiple audio streams


djonnie

Recommended Posts

djonnie

To prevent transcoding on my not so modern PC I wanted to convert some files from MKV (H264) to Webm to play them without transcoding in the Web Client. Since my kids like to hear the Dutch version and I like to hear the English version, the .webm file has 2 audio streams.

 

I created a test file and tried to play it with VLC player (just by doubleclicking it in Explorer) which worked fine. I can easily switch the audio languages.

 

Then I uploaded the file to Emby Server (3.0.5641.4) on Windows 8.1 Pro:

 

55956ea779798_3.jpg

 

Playing the file with Emby Theater works fine including switching the audio language.

 

And I tried to play the file with the Web Client (tried Firefox 38.0.5) and Opera (30.0). Playing went fine. There was no ffmpeg process started which was the reason to start with this after all.

 

From the server log:

 

Ip: <my ip:port>. Headers: Host=<emby server ip>:8096,Connection=keep-alive,Content-Length=2347,Accept=application/json, text/javascript, */*; q=0.01,X-MediaBrowser-Token=c6ac9c608a764ff99fd5d7db9bb142ff,User-Agent=Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.125 Safari/537.36 OPR/30.0.1835.88,Authorization=MediaBrowser Client="Emby Web Client", Device="Chrome 43.0.2357.125", DeviceId="b22df2f21e385076a5424b8472257d1c60b94536", Version="3.0.5641.4", UserId="e66d37d26b09741b17b4c2f2e4c66a85",Origin=http://<emby server ip>:8096,Content-Type=application/json,Accept-Encoding=gzip, deflate, lzma,Accept-Language=nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4

 

2015-07-02 18:54:58.5621 Debug - App: Profile: Unknown Profile, Path: <path to my file>test25.webm, isEligibleForDirectPlay: True, isEligibleForDirectStream: True

 

 

 

Screendump from the Web Client:

 

55956f874a304_6.jpg

 

But switching the audio language is impossible. I noticed there's no green check icon next to the standard audio language (it plays the default audio language fine), but switching to a different language is impossible:

 

55956feca27df_4.jpg

 

Does someone know a solution for this?

Link to comment
Share on other sites

djonnie

hmm, also happens with .mp4

 

when I force transcoding (by lowering the bitrate) I can change the audio track:

 

55963bbfe0850_5.jpg

Link to comment
Share on other sites

yea i think the main thing is the html video player has control there and i'm not sure there's a way for us to tell it which track to use. we'd probably have to force transcoding.

Link to comment
Share on other sites

djonnie

Thanks Luke

 

I guess it isn't possible to place the audio streams in separate files, apart from the video, so that the web client will load the appropriate audio stream?

Link to comment
Share on other sites

  • 4 months later...

Well, thanks guys. I didn't even know that you could encode two language tracks in the same container file. I've just ripped with Handbrake. The first track as AC3 and the second as AC3 Passthru. Works in VLC I'll see whether it works in Emby.

Link to comment
Share on other sites

It will play and work just fine, whether it works in the way you're desiring or expecting depends entirely on the capabilities of the device you're trying to play from.

Link to comment
Share on other sites

  • 2 weeks later...
supermau

I just had the same problem with mp4, webm and mkv (with extension renamed to mp4 to avoid transcode in chrome which is the browser I use in my setup - documented in this thread: http://emby.media/community/index.php?/topic/27824-emby-web-client-stuttering/).

 

After quite a lot of digging it seams we don't have multitrack support natively in a browser due to the lack of support (You could try in IE or Safari which apparently has support for it at this time, I'm on linux so I couldn't test it on those browsers)

 

565e64f9e6284_borra.png

 

565e666b34cdd_borra.png

 

Sources:

 

https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist-and-videotracklist-objects

http://www.w3schools.com/tags/av_prop_audiotracks.asp

https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats#Browser_compatibility

http://www.webmproject.org/docs/container/

https://html.spec.whatwg.org/multipage/embedded-content.html

  • Like 1
Link to comment
Share on other sites

Chrome is usually the first to implement these things, so as soon it has it, we'll add support for it.

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

3 years later...

Any news on track switching support in any browser? (Firefox/Chrome on Linux?)

 

The only reason I'm still looking for alternatives to Emby (or Plex, for that matter) is that transcoding is still required after all this time though all my tracks are VP9, Opus (multiple) and WebVTT (multiple) and my browsers support webm...

 

Instead of transcoding perfectly good streams to lower quality H264/MP3|AAC, why not stream with -codec copy and just map a subset of the streams into a new container?

Link to comment
Share on other sites

Then for some reason I can't get it to work.

 

Setup:

Ubuntu 18.04.1 LTS 64-bit

emby-server 3.5.2.0

Player: Google Chrome 69.0.3497.100 (Official Build) (64-bit)

 

When playing the default audio stream (english, opus) it streams using direct play but as soon as I switch to second audio stream (french, opus) transcoding starts.
 

Stats for Nerds (while playing secondary audio stream):

5bb19d2fa0b40_StatsForNerds.png

 

I tried remuxing the same file and keeping only the second audio stream and it plays with direct play so there is nothing wrong with the streams themselves.

Link to comment
Share on other sites

Ok so we have implemented this previously and it still works in supported browsers, however it appears Chrome has removed support for this right now. The audioTrackList property is now gone from the video element.

 

It was always an experimental api anyway and not part of any documentation. My guess is they are probably working on rolling out a new track switching api. For now, I don't see anything we an do about this.

Link to comment
Share on other sites

As I suggested before, instead of transcoding perfectly good streams to lower quality H264/MP3|AAC, why not stream with -codec copy and just map a subset of the streams into a new container?

 

For example, mapping all video/subtitle streams but only the secondary audio stream:

 

$ ffprobe -i orig.webm |& grep Stream
    Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv), 718x360, SAR 161:136 DAR 57799:24480, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: opus, 48000 Hz, 6.1, fltp (default)
    Stream #0:2(fre): Audio: opus, 48000 Hz, stereo, fltp
    Stream #0:3(eng): Subtitle: webvtt
    Stream #0:4(fre): Subtitle: webvtt
$ ffmpeg -i orig.webm -map 0:0 -map 0:2 -map 0:3 -map 0:4 -codec copy -f webm secondary-audio.webm
...
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
  Stream #0:3 -> #0:2 (copy)
  Stream #0:4 -> #0:3 (copy)
...
$ ffprobe -i secondary-audio.webm |& grep Stream
    Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv), 718x360, SAR 161:136 DAR 57799:24480, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(fre): Audio: opus, 48000 Hz, stereo, fltp
    Stream #0:2(eng): Subtitle: webvtt
    Stream #0:3(fre): Subtitle: webvtt
 

Link to comment
Share on other sites

Because a progressive stream like that isn't seek-able. In order to make it seek-able we use the HLS segmented format. But, to my knowledge, the browsers don't support vp9 in hls, and that's why the video ends up getting transcoded as well.

Link to comment
Share on other sites

So for live transcoding you need to use HLS which requires a H.264 encoding into equal length TS segments... I get it (read up a bit).

If this was the original .webm file you'd use "Video" (DASH?) streaming protocol instead of HLS, right?

 

As I understand it DASH, having variable length segments, would require a bit more work to get things ready for streaming.

How much CPU/Time would it take to copy the individual streams into a new .webm container and prepare the segments for DASH?

 

Personally, I'd greatly appreciate the option to postpone watching a video for 20 seconds to let Emby prepare a on-the-fly temporary version (keeping around n days) and be able to watch with the intended quality.

Can I vote anywhere?

Link to comment
Share on other sites

We currently don't use dash because all devices nowadays support HLS, but it's possible for the future. Thanks.

Link to comment
Share on other sites

So you don't use DASH... When I stream a .webm with vp9/opus/webvtt the streaming type stat says "Video", not "HLS".... What does "Video" stand for then?

Link to comment
Share on other sites

It would just be direct playing the video file as-is, no conversion or re-packaging needed. 

Link to comment
Share on other sites

Then it should be relatively simple to take the time to make a temporary .webm with just the right streams and direct play it.

The temporary webm could be kept around for a number of days to save space

Link to comment
Share on other sites

"Automatically Convert Content: Convert your content into streaming friendly formats on a schedule or when they are added."

Not quite what I had in mind... Sounds like a feature for non-technical people. My content is already in streaming friendly format which I've worked had to create, I don't want to double the size of my library just because I want multiple languages.

 

Looking at your intro of this feature, it doesn't seem to do what I want: Re-mux a temporary video with a specific audio track. No transcoding and no long-term storage involved.

Link to comment
Share on other sites

Well, we do that when the source is h264, in this case it isn't. In the future we'll add dash support and then we'd be able stream copy the original video from webm.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...