How to extract h264 and aac elementary stream from an mp4 / mkv using gstreamer
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 ?
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
链接地址: http://www.djcxy.com/p/43924.html