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

Toby Widdows toby at rosecott.net
Wed Mar 10 17:35:17 UTC 2021


Hi,

Sorry I have not replied to this, real life got in the way!!

Thanks for this, it made sense, and has increased my ability to understand the command greatly.  i have tested this with single video and multiple audio tracks, and it works like a charm.

Apart from when there a TrueHD audio track, then I get this

WARNING: from element /GstPipeline:pipeline0/GstMatroskaDemux:demux: Delayed linking failed.
Additional debug info:
./grammar.y(510): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstMatroskaDemux:demux:
failed delayed linking pad  audio_0 of GstMatroskaDemux named demux to some pad of GstQueue named queue2

the command i am giving is this.

 gst-launch-1.0 filesrc location="/external/test/pickup/2.mkv" ! matroskademux name=demux \
demux.video_0 ! queue ! video/x-h264 ! h264parse ! nvv4l2decoder ! nvv4l2h265enc bitrate=3500000 ! h265parse ! queue ! mux.video_0 \
demux.audio_0 ! queue ! mux.audio_0 \
matroskamux name=mux ! progressreport update-freq=1 ! filesink location="/external/test/pickup/2new.mkv"

gst-discoverer gives me this for audio

    audio: AC-3 (ATSC A/52)
    audio: AC-3 (ATSC A/52)
    audio: DTS
    audio: E-AC-3 (ATSC A/52B)
      audio: AC-3 (ATSC A/52)
    audio: AC-3 (ATSC A/52)
    audio: DTS
    audio: Dolby TrueHD


if I use any other index than 0 it works like a dream, as there are duplicates of all codec's apart from Dolby TrueHD, I am assuming that is the problem.

Also if I use the same mechinism for subtitles it just does not work, regardless of the format of the subtitles, I get 

WARNING: from element /GstPipeline:pipeline0/GstMatroskaDemux:demux: Delayed linking failed.
Additional debug info:
./grammar.y(510): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstMatroskaDemux:demux:
failed delayed linking pad  subtitle_0 of GstMatroskaDemux named demux to some pad of GstQueue named queue2

I generated that message with this command

 gst-launch-1.0 filesrc location="/external/test/pickup/2.mkv" ! matroskademux name=demux \
demux.video_0 ! queue ! video/x-h264 ! h264parse ! nvv4l2decoder ! nvv4l2h265enc bitrate=3500000 ! h265parse ! queue ! mux.video_0 \
demux.subtitle_0 ! queue ! mux.subtitle_0 \
matroskamux name=mux ! progressreport update-freq=1 ! filesink location="/external/test/pickup/2new.mkv"

I get that regardless of if the subtitle is "Timed Text" or "PGS subtitles".

I'm presuming the errors I am getting are because of matroskamux not having pads for the codec being used, even though it says it has for text subtitles.

The help provided has been great, and my understanding is growing.  But I think I still have a long way to go in understand gstreamer.

regards

Toby








------ Original Message ------
From: "gotsring" <gotsring at live.com>
To: gstreamer-devel at lists.freedesktop.org
Sent: 05/03/2021 21:18:42
Subject: Re: Re[2]: Questions about transcoding video with audio and subtitle passthrough using MKV files

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/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list