简体   繁体   English

gstreamer将音频和视频编码为avi文件

[英]gstreamer encoding audio and video to avi file

I am trying to use the gstreamer to encode h264 video and audio in to a single .avi file. 我正在尝试使用gstreamer将h264视频和音频编码为单个.avi文件。 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". 这将返回错误消息:“无法将queue2链接到多路复用器”。

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." 我知道该示例使用的是me脚的编码方式,但是当gstremer 文档说:“请注意,MP3不是免费格式,存在许可和专利问题时,我却不像Ugly Plug-ins那样使用它。考虑到这一点,请参阅Ogg / Vorbis,以获得免版税(通常质量更高)的替代方案。”

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: 似乎将声音设置为audiotestsrc并禁用音频编码gstreamer时,会创建.avi文件,并且可以在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: 但是尝试对alsasrc进行相同操作会使avi文件仅保存音频数据而不保存视频:

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

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. 在深入研究了Gstreamer文档之后,我发现了这一点: http ://trac.gateworks.com/wiki/Yocto/gstreamer/audio#Encoding,其中列出了所有适用的编码器。

Checking the avimux again I saw it can receive data in the audio/x-alaw format. 再次检查avimux ,我发现它可以接收音频/ x-alaw格式的数据。 with that fact I can use the alawenc that belongs to the gst-plugins-good instead of the lamemp3enc . 对于这个事实,我可以使用alawenc属于GST-plugins的好,而不是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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM