[gst-devel] Using gst-launch to convert between video formats on the command line?

Mark Nauwelaerts manauw at skynet.be
Mon Oct 2 20:02:35 CEST 2006


Michael R. Head wrote:
> Thanks for the help Zaheer and Michal!
> 
> On Mon, 2006-10-02 at 07:48 +0200, Zaheer Merali wrote:
>> On 10/2/06, Michael R. Head <burner at suppressingfire.org> wrote:
>>> Hi,
>>>
>>> I've got some video files in the matroska format that I would like to
>>> repack into the avi format. The codecs used in the file are Xvid and and
>>> AAC, and I'd like to simply reuse the audio and video bitstreams in the
>>> new file (I don't want to do any transcoding). So far, I've figured out
>>> how to take the video stream and put it into the avi, like so:
>>>
>>> gst-launch-0.10 filesrc location="in.mkv" ! matroskademux ! avimux ! filesink location=out.avi
>>>
>>> But the audio channel gets lost. What am I missing?
>>>
>> Yes one of the channels will get lost because demuxers create pads for
>> each media channel inside the stream, so your pipeline only linked one
>> of these pads.
> 
> Yeah, I thought it this was the problem, but I haven't quite grokked the
> pipeline syntax.
> 
>> Try:
>>
>> gst-launch-0.10 avimux name=mux ! filesink location=out.avi filesrc
>> location=in.mkv ! matroskademux name=d ! queue ! mux. d. ! queue !
>> mux.
> 
> OK, I tried that, but there was a problem:
> $ gst-launch-0.10 avimux name=mux ! filesink location=out.avi filesrc \
>  location=in.mkv ! matroskademux name=d ! queue ! mux. d. ! queue ! mux.
> WARNING: erroneous pipeline: could not link queue0 to mux
> 
>> Zaheer
> 
> On Mon, 2006-10-02 at 11:37 +0200, Michal Benes wrote: 
>> Hi Mike,
>> 	your pipeline remuxes only the first stream detected by matroska. Try
>> gst-launch-0.10 filesrc location="in.mkv" ! matroskademux name=d \
>>                 d.video_00 ! queue ! m. \
>>                 d.audio_00 ! queue ! m. \
>>                 avimux name=m ! filesink location=out.avi
> 
> I tried this, too: 
> $ gst-launch-0.10 filesrc location="in.mkv" ! matroskademux name=d \
>  d.video_00 ! queue ! m. d.audio_00 ! queue ! m.  avimux name=m ! \
>  filesink location=out.avi
> WARNING: erroneous pipeline: could not link queue1 to m
> 
> 
>> If it does not work, try to specify the complete capabilities
>> (e.g. ... queue ! video/mpeg, version=4 ! m.)
> 
> So then I tried that, and the pipeline appeared to hang:
> $ gst-launch-0.10 filesrc location="in.mkv" ! matroskademux name=d \
>  d.video_00 ! queue ! video/mpeg, version=4 ! m. d.audio_00 ! queue ! \
>  m.  avimux name=m ! filesink location=out.avi
> Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
> 
> 
> Any more suggestions?
> 

Both of the problems are (probably) typical of failing caps negotiation.
In this case, you said that the mkv contains AAC, but the caps on avimux do not
support AAC, only mpegversion 1 (leaving aside any discussion whether or not an
AVI file can or should contain AAC). If you modify the pipeline to transcode the
audio to e.g. mp3 (or ac3), then it should be OK.

So, e.g. (though personally haven't done much with the AAC elements)

gst-launch-0.10 filesrc location="in.mkv" ! matroskademux name=d \
                d.video_00 ! queue ! m. \
                d.audio_00 ! queue ! faad ! audioconvert ! lame ! m. \
                avimux name=m ! filesink location=out.avi

Regards,
Mark.




More information about the gstreamer-devel mailing list