Reputation: 1065
I could not find a stable and balanced approach to demux the A/V stream and then save it as a playable h264 annex B format video.
Well, I tried the following steps for shrinkage file.
gst-launch-0.10 filesrc location=h264_720p_mp_3.1_3mbps_aac_shrinkage.mkv ! matroskademux ! filesink location=abc.h264
-rw-rw-r-- 1 XXX XXX 28697147 Nov 1 10:04 h264_720p_mp_3.1_3mbps_aac_shrinkage.mkv
-rw-rw-r-- 1 XXX XXX 27581733 Nov 1 10:19 abc.h264
a file got saved with "not so smaller" size but is not playable, however the parent container format is playable with the following pipeline
gst-launch-0.10 filesrc location=h264_720p_mp_3.1_3mbps_aac_shrinkage.mkv ! matroskademux ! h264parse ! ffdec_h264 ! ffmpegcolorspace ! ximagesink
Questions
Q1. What are the methods to extract the video ES and Audio ES from different containers using gstreamer ?
Q2. Q1 using some other methods which always works and/or are easy ?
Upvotes: 2
Views: 4349
Reputation: 481
Following all commands works for me. It creates h.264 byte stream file from mp4 video file. Newly created file also played using ffplay or gst-play-1.0
gst-launch-1.0 filesrc location=./VID-20190903-WA0012.mp4 ! qtdemux name=pnkj_demux ! h264parse ! video/x-h264,stream-format=byte-stream ! filesink location=./VID-20190903-WA0012_1.264
gst-launch-1.0 -e filesrc location=./VID-20190903-WA0012.mp4 ! qtdemux name=pnkj_demux ! h264parse ! video/x-h264,stream-format=byte-stream ! filesink location=./VID-20190903-WA0012_2.264
gst-launch-1.0 filesrc location=./VID-20190903-WA0012.mp4 ! qtdemux name=pnkj_demux pnkj_demux.video_0 ! h264parse ! video/x-h264,stream-format=byte-stream ! filesink location=./VID-20190903-WA0012_3.264
gst-launch-1.0 -e filesrc location=./VID-20190903-WA0012.mp4 ! qtdemux name=pnkj_demux pnkj_demux.video_0 ! h264parse ! video/x-h264,stream-format=byte-stream ! filesink location=./VID-20190903-WA0012_4.264
Upvotes: 0
Reputation: 31
In general, you need to specify which pad you're interested in. Otherwise you couldn't distinguish the audio ES from the video ES.
The following works on my machine:
gst-launch-1.0 filesrc location=example.mkv ! queue ! matroskademux name=dmux dmux.video_0 ! queue ! filesink location=vid.265 dmux.audio_0 ! queue ! filesink location=aud.aac
Upvotes: 1