Questions about transcoding video with audio and subtitle passthrough using MKV files

gotsring gotsring at live.com
Fri Mar 5 21:18:42 UTC 2021


I sure hope I'm not explaining this wrong, but here goes:
It looks like they're manually directing *types* of streams between the
demuxer and muxer instead of letting it try to decide on its own.

Broken down, you have 3 sections of the pipeline:
1. The demuxer, which reads an existing file and splits out the types of
streams (like audio, video, subtitles)
2. The transcode/passthrough, where each individual stream is transcoded
(video) or left alone (audio).
3. The muxer, which re-combines the new streams into an output file

So looking at the pipeline, you can break that into 3 sections:
Demuxer section:
  filesrc location=2.mkv ! matroskademux name=demux 

Transcode/Passthrough section
  demux.video_0 ! queue ! video/x-h264 ! h264parse ! nvv4l2decoder !
nvv4l2h265enc bitrate=20000000 ! h265parse ! queue ! mux.video_0 
  demux.audio_0 ! queue ! mux.audio_0 

Muxer Section
  matroskamux name=mux ! progressreport update-freq=1 ! filesink
location=2222.mkv

You'll notice that the transcode/passthrough section is much larger because
they are routing individual streams instead of the one file. You'll also
notice that they are using named elements to take things from the demuxer
and put it into the muxer (conveniently named demux and mux).

So the video is transcoded here:
  demux.video_0 ! queue ! video/x-h264 ! h264parse ! nvv4l2decoder !
nvv4l2h265enc bitrate=20000000 ! h265parse ! queue ! mux.video_0

And the audio stream is left as is and routed from the audio_0 pad of the
demuxer to the audio_0 pad of the muxer.
  demux.audio_0 ! queue ! mux.audio_0

If there was another audio track, you could also pass that forwards by
incrementing the pad count:
  demux.audio_1 ! queue ! mux.audio_1

Hopefully that clarifies the format so you can adjust it to your needs.




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list