Multiple video tracks in one file

I think this is a great idea. I have many mkv files of films in a wider aspect than 16:9. I have always used ffmpeg to produce a second stream cropped to the 16:9 format and, when absolutely required to show important content, panned too. As you can imagine getting the panning right is quite time consuming. I was very disappointed when I was not able to play the cropped stream using Plex. Being able to play the cropped stream is especially useful when playing back the media on smaller devices such as smartphones.

Plex does not play as well with mkv as we would like. I’m not sure they handle stream metadata other than title and language. They seem to have no regard for the default disposition when assigned to an audio stream. That said - Has anyone tried writing the program metadata when muxing multiple video streams? As a rule ffmpeg assigns the “default” disposition to the first mapped stream of each type if not found in the input or assigned in the command. Could be that Plex will just find the first program and ignore the others. Assignment of streams to a program within the container may give us the flexibility to define how we want the content to appear, and an easier way for the Plex dev team to implement this feature.
A Program, in the context of a media container, is a metadata entry with a title and a list of streams. Players should prioritize programs over individual streams. For a movie with multiple angle streams, you may have a program titled “Theatrical” with the angle 1 video and all audio and subtitle streams; then a second program titled “Alternate” with the angle 2 video and again all audio and sub streams.
Not sure how Plex will handle it, but it’s something to try.

I put together a test file with two programs having two video streams and two audio streams. They are the Theatrical release and a Guided commentary version. Each program is assigned one video stream and one audio stream. Below is the info for the file as seen by Plex. All four streams are identified, however only one “Part” is defined and only the audio is selectable during playback.

If Plex were to recognize Programs… A quiet upgrade would be possible, such that when the user selects an audio or subtitle track, Plex should use the video stream with the same Program ID. Otherwise an upgrade would involve the UI and then anything is possible.
This solution is not one that helps with resolutions because in order to auto-select, you must duplicate the audio track for selection. This saves no space and is better handled using the Plex Versions library layout. Regarding pre-transcoding several versions into files for different players. I have it on good authority that Disney holds files for each resolution they will need to serve.

command:
ffmpeg -i theater.mkv -i guided.mkv -map 0:0 -map 0:1 -map 1:0 -map 1:1 -program “program_num=1:title=Theater:st=0:st=1” -program “program_num=2:title=Guided:st=2:st=3” -c copy…

<Media id=“112501” duration=“90016” bitrate=“24127” width=“1920” height=“1080” aspectRatio=“1.78” audioChannels=“6” audioCodec=“ac3” videoCodec=“vc1” videoResolution=“1080” container=“mkv” videoFrameRate=“24p” videoProfile=“advanced”>
<Part accessible=“1” exists=“1” id=“162714” key=“/library/parts/162714/1711915305/file.mkv” duration=“90016” file=“~/Media/Videos/Extras/Cop Out test.mkv” size=“271471389” container=“mkv” videoProfile=“advanced”>
<Stream id=“428244” streamType=“1” default=“1” codec=“vc1” index=“0” language=“English” languageTag=“en” languageCode=“eng” bitDepth=“8” chromaLocation=“left” chromaSubsampling=“4:2:0” codedHeight=“1080” codedWidth=“1920” colorPrimaries=“bt709” colorSpace=“bt709” colorTrc=“bt709” frameRate=“23.976” height=“1080” level=“3” profile=“advanced” refFrames=“1” scanType=“progressive” title=“Theatrical” width=“1920” displayTitle=“1080p (VC1)” extendedDisplayTitle=“Theatrical (1080p VC1)”>
<Stream id=“428246” streamType=“1” codec=“vc1” index=“2” language=“English” languageTag=“en” languageCode=“eng” bitDepth=“8” chromaLocation=“left” chromaSubsampling=“4:2:0” codedHeight=“1080” codedWidth=“1920” colorPrimaries=“bt709” colorSpace=“bt709” colorTrc=“bt709” frameRate=“23.976” height=“1080” level=“3” profile=“advanced” refFrames=“1” scanType=“progressive” title=“Guided” width=“1920” displayTitle=“1080p (VC1)” extendedDisplayTitle=“Guided (1080p VC1)”>
<Stream id=“428245” streamType=“2” selected=“1” default=“1” codec=“ac3” index=“1” channels=“6” bitrate=“448” language=“English” languageTag=“en” languageCode=“eng” audioChannelLayout=“5.1(side)” samplingRate=“48000” title=“Surround 5.1” displayTitle=“English (AC3 5.1)” extendedDisplayTitle=“Surround 5.1 (English AC3)”>
</Stream>
</Part>
</Media>

I can do this in Kodi. Too bad i like Plex more…

1 Like

I would also like this very basic feature added. I have a few shows and movies that have alternate angles/takes on several scenes. Like someone mentioned above I also have Star Trek TOS which has the remastered and original versions. A lot of times I like flipping between them as I’m watching. That also means the idea just using multiple files with multiple editions isn’t a viable option. That requires exiting playback, starting playback on a new file, and then seeking to where I was. I need to be able to change video streams like I can change audio streams.

This’d be great for shows with upgraded FX alongside the original e.g Star Trek, Doctor Who, Blake’s 7

Hello Plex team,

I would like to support this feature request to allow manual selection of video tracks within a single MKV file.

My use case: I am restoring old black & white films using AI colorization (DeOldify), and I multiplex both the original and the colorized versions into a single MKV container using MKVToolNix.

It would be very convenient for viewers to choose which video version they want to watch — original or remastered — from the Plex client interface, just like we already can with audio tracks or subtitles.

Currently, Plex always plays the first video track and provides no way to switch to another. This makes the inclusion of multiple video tracks essentially invisible to the user.

It would be greatly appreciated to support video track selection, at least in Plex Web and desktop clients.

Thank you for your consideration and for your continuous work on the platform.

— A long-time Plex user and archival film enthusiast.

I support this feature for a bunch of reasons.

  1. Accessibility. Some movies have a stream with a sign language interpreter on-screen for the duration of the movie. Closed captions are helpful, but for some native speakers of ASL or another sign language, CC can be like a foreign language. A second video stream that includes a sign language interpreter is more inclusive to the deaf & hard of hearing community than closed captioning alone.
  2. Education. Some movies come with a feature-length storyboard that is timed to match shot-for-shot with an existing video stream containing the finished film, using the same audio. Swapping between them would allow people learning filmmaking or storyboarding to see how the storyboard translated into the finished product throughout the film.
  3. Different aspect ratios. Movies are typically released either as 16:9 (HD widescreen) or 21:9 (cinematic widescreen), but it’s not uncommon to find releases in 4:3 (full frame), 19:10 (IMAX), or 37:20 (US & UK cinema widescreen). Some vertical formats for content designed to be consumed on mobile devices are popping up as well. Each one is optimized for a different type of screen, and if someone has a video with multiple different resolutions it would be nice to have the abililty to choose the one that fits the screen you’re using to watch the movie.

There are a ton of other reasons. I know some of the technical issues listed above (significantly increased bitrate processing, for example) could make this challenging, but this would allow people who have bottlenecks for storage without similar bottlenecks for video processing to fully utilize the hardware they already own without a degradation in performance. As long as the limitations are documented, I don’t see this as a reason not to implement it so much as a point of caution for people who might want to use the feature on lower-end hardware.

It’s also worth mentioning that Kodi has had this ability in their stable release channel since February 2017, over 8 years ago – and less than 18 months after this was originally suggested. If this was a problem to handle, it appears that Kodi devs found a way to solve the problem. I have every confidence that the Plex dev team is more than capable of solving it, too.

1 Like