Search code examples
audiovideogstreamermux

how to mux audio and video in gstreamer


I'm trying to mux a .ogv only video file with a .mp3 file to get a .ogv file with both video and audio, in gstreamer (v0.10). I try this pipeline :

gst-launch-0.10 filesrc location="video.ogv" ! oggdemux ! queue ! oggmux name=mux ! filesink location="test.ogv" filesrc location="audio.mp3" ! audioconvert ! vorbisenc ! queue ! mux.

When I use this command line, i get an error :

ERROR : of element /GstPipeline:pipeline0/GstAudioConvert:audioconvert0 : not negotiated
Additional debogging information :
gstbasetransform.c(2541): gst_base_transform_handle_buffer (): /GstPipeline:pipeline0/GstAudioConvert:audioconvert0:
not negotiated
ERROR : the pipeline refuse to pass in preparation phase

I can't see what's wrong. Any suggestion ? Thanks.


Solution

  • You need to add an MP3 decoder between the filesrc and audioconvert, or just decodebin e.g.

    gst-launch-0.10 filesrc location="video.ogv" ! oggdemux ! queue ! oggmux name=mux ! filesink location="test.ogv" 
        filesrc location="audio.mp3" ! decodebin ! audioconvert ! vorbisenc ! queue ! mux.