Hi,
I am by no means a developer, and I have struggled to get my head around gstreamer. I have what on the face of seems like a simple issue and one which I have achieved with FFMPEG and some linux scripting, however I have a jetson nano that i want to use for this, and the FFMPEG someone has built to support the nvidia encoders and decoders gives me weird video issues, and as the nvidia forums promote gstreamer, I thought I would give this a go.. I have video in MKV containers in H264 video format with multiple audio and multiple subtitle tracks. I want to be able to transcode the video, and passthrough all the audio and subtitle tracks into a new MKV file. I have figured out how to do the video, but can not get my head around the methods needed to do the audio and subtitle tracks. I can discover how many audio and subtitle tracks there are and can build a script around all this, if I could only just figure out the syntax for gst-launch. Help much appreciated. And apologies in advance for the series of stupid questions that may come out of this thread this is my starting point :- gst-launch-1.0 filesrc location=./2.mkv \ ! matroskademux \ ! h264parse \ ! nvv4l2decoder \ ! nvv4l2h265enc bitrate=2000000 \ ! h265parse \ ! matroskamux \ ! progressreport update-freq=1 \ ! filesink location=./new2.mkv Thanks again in advance Toby _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
I'll be honest, I've not really dealt with more than one stream out of
matroskademux, so not sure if there's a more automatic way. You can try something like this. This assumes the audio is FLAC, thus the flacparse, but you should be able to change out the parser (or maybe remove it?) for other audio streams. gst-launch-1.0.exe filesrc location=2.mkv ! matroskademux name=d \ d.video_0 ! queue ! h264parse ! nvv4l2decoder ! nvv4l2h265enc bitrate=2000000 ! h265parse ! matroskamux name=m ! filesink location=new2.mkv \ d.audio_0 ! queue ! flacparse ! m. \ d.audio_1 ! queue ! flacparse ! m. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
So by 'remove it' you mean remove the '! Flacparse'
Regards
Toby
On 5 Mar 2021, 16:54 +0000, gotsring <[hidden email]>, wrote:
I'll be honest, I've not really dealt with more than one stream out of _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Yep. Though I would expected that you probably have to replace it with an
audio parser that matches your audio streams. You'll have to experiment with this. You can test the outputs with gst-play-1.0. I think pressing 'a' or 's' in the output window switches between the audio and subtitle streams, so you can verify that they're all there. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
so i've been fiddling and can get the audio streams to pass through if i know what they are eg gst-launch-1.0 filesrc location=2.mkv ! matroskademux name=demux demux.video_0 ! queue ! h264parse ! nvv4l2decoder ! nvv4l2h265enc bitrate=2000000 ! h265parse ! matroskamux name=mux ! progressreport update-freq=1 ! filesink location=2222.mkv demux.audio_0 ! queue ! aacparse ! mux. this works and will parse the AAC audio track through the output with no apparent loss in performance I got this from the Nvidia forum for gstreamer and it does the same thing but does not need to know what the audio stream is gst-launch-1.0 filesrc location=2.mkv ! matroskademux name=demux demux.video_0 ! queue ! video/x-h264 ! h264parse ! nvv4l2decoder ! nvv4l2h265enc bitrate=20000000 ! h265parse ! queue ! mux.video_0 demux.audio_0 ! queue ! mux.audio_0 matroskamux name=mux ! progressreport update-freq=1 ! filesink location=2222.mkv I can see there are differences but because i cant understand the command structure, and it appears to be very flexible, i cant make the top work using the bottom one commands. everything is in a different order! and to my poor brain that just seems wrong! TIA Toby ------ Original Message ------ From: "gotsring" <[hidden email]> To: [hidden email] Sent: 05/03/2021 17:32:08 Subject: Re: Questions about transcoding video with audio and subtitle passthrough using MKV files Yep. Though I would expected that you probably have to replace it with an audio parser that matches your audio streams. You'll have to experiment with this. You can test the outputs with gst-play-1.0. I think pressing 'a' or 's' in the output window switches between the audio and subtitle streams, so you can verify that they're all there. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
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 [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
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" <[hidden email]> To: [hidden email] 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 [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
I also couldn't get subtitles to work using gst-launch, but I wasn't sure if
that's because I was generating test files wrong or because I'm using Windows. It might be the case that you have to do more complex linking using c/python code rather that just a gst-launch command, but more likely is that I don't know what I'm doing. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Haha.
You have way more idea about it than I do!! I'm not going to learn c or python for this. I can do it long way round by dumping the true hd and subtitles to files and then remixing them with ffmpeg or mkv merge. I can handle that with scripting. Would be nice to know why the true hd and subs don't work though Regards
Toby
On 10 Mar 2021, 18:11 +0000, gotsring <[hidden email]>, wrote:
I also couldn't get subtitles to work using gst-launch, but I wasn't sure if _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |