Reputation: 411
I am trying to use the gstreamer to encode h264 video and audio in to a single .avi file. I'm able to encode audio or video using this for video:
gst-launch-1.0 appsrc name=appsrc ! deinterlace name=deinterlace ! mfxh264enc name=mfxh264enc ! avimux name=mux ! filesink name=filesink location=test.avi
and this for audio:
gst-launch-1.0 alsasrc ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=audioTestQueue.mp3
I'm trying to combine them according to this example with this pipe:
gst-launch-1.0 appsrc name=appsrc ! deinterlace name=deinterlace ! mfxh264enc name=mfxh264enc ! queue name=queue1 ! mux. alsasrc name=alsasrc ! audioconvert name=audioconvert ! vorbisenc name=vorbisenc ! queue name=queue2 ! mux. avimux name=mux ! filesink name=filesink location=test.avi
this returns an error saying: "could not link queue2 to mux".
I know that the example is using the lame to encode but I rather not using it as it is in the Ugly Plug-ins source when the gstremer documentation say: "Note that MP3 is not a free format, there are licensing and patent issues to take into consideration. See Ogg/Vorbis for a royalty free (and often higher quality) alternative."
what am I doing wrong?
EDIT:
it seems that when setting the sound to the audiotestsrc and disabling the audio encodeing gstreamer creates the .avi file and I'm able to play it in VLC:
gst-launch-1.0 appsrc name=appsrc1 ! deinterlace name=deinterlace1 ! mfxh264enc name=mfxh264enc1 ! queue name=queue11 ! mux. audiotestsrc name=alsasrc1 ! audioconvert name=audioconvert1 ! queue name=queue31 ! mux. avimux name=mux ! filesink name=filesink1 location=test.avi
but trying to do the same with alsasrc makes the avi file to save only the audio data without the video:
gst-launch-1.0 appsrc name=appsrc1 ! deinterlace name=deinterlace1 ! mfxh264enc name=mfxh264enc1 ! queue name=queue11 ! mux. alsasrc name=alsasrc1 ! audioconvert name=audioconvert1 ! queue name=queue31 ! mux. avimux name=mux ! filesink name=filesink1 location=/home/user/Downloads/HDTest1.avi
Upvotes: 1
Views: 2945
Reputation: 411
After digging more into the Gstreamer documentation I discovered this:http://trac.gateworks.com/wiki/Yocto/gstreamer/audio#Encoding where it list all the encoders avilable.
Checking the avimux again I saw it can receive data in the audio/x-alaw format. with that fact I can use the alawenc that belongs to the gst-plugins-good instead of the lamemp3enc.
so my final pipe is as so:
gst-launch-1.0 alsasrc name=pulsesrc1 ! audioconvert name=audioconvert1 ! alawenc name=alawenc1 ! queue name=aud1 ! mux. appsrc name=appsrc1 ! deinterlace name=deinterlace1 ! mfxh264enc name=mfxh264enc1 ! mux. avimux name=mux ! filesink name=filesink1 location=HDTest1.avi
Upvotes: 0