Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用gstreamer从mp4(h264/aac)到mp4(h264/mp3)进行代码转换和大小调整?_Gstreamer_Mp4_H.264_Aac_Gst Launch - Fatal编程技术网

如何使用gstreamer从mp4(h264/aac)到mp4(h264/mp3)进行代码转换和大小调整?

如何使用gstreamer从mp4(h264/aac)到mp4(h264/mp3)进行代码转换和大小调整?,gstreamer,mp4,h.264,aac,gst-launch,Gstreamer,Mp4,H.264,Aac,Gst Launch,我想使用gstreamer对mp4进行转码和调整大小(mp4-h264_1920x1080/aac=>mp4-h264_640x480/mp3)。我写下了这个命令 $ gst-launch-0.10 filesrc location=./gain_1.mp4 ! qtdemux name=demux demux.video_00 ! queue ! ffdec_h264 ! videoscale ! 'video/x-raw-yuv,width=640,height=480' ! x264enc

我想使用gstreamer对mp4进行转码和调整大小(mp4-h264_1920x1080/aac=>mp4-h264_640x480/mp3)。我写下了这个命令

$ gst-launch-0.10 filesrc location=./gain_1.mp4 ! qtdemux name=demux demux.video_00 ! queue ! ffdec_h264 ! videoscale ! 'video/x-raw-yuv,width=640,height=480' ! x264enc ! queue ! qtmux name=mux mux.video_0 demux.audio_00 ! queue ! ffdec_aac ! lame bitrate=128 ! queue ! mux.audio_0 mux. ! filesink location=0000.mp4 –v -e
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
^CCaught interrupt -- handling interrupt.
Interrupt: Stopping pipeline ...

(gst-launch-0.10:17958): GLib-CRITICAL **: Source ID 1 was not found when attempting to remove it
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
这没用

视频转码仅适用于:

gst-launch-0.10 filesrc location=./gain_1.mp4 ! qtdemux name=demux demux.video_00 ! queue ! ffdec_h264 ! videoscale ! 'video/x-raw-yuv, width=640, height=480' ! x264enc ! queue ! mux. mp4mux name=mux ! filesink location=0000.mp4 –v -e
并且仅对音频进行转码:

gst-launch-0.10 filesrc location=./gain_1.mp4 ! qtdemux name=demux demux.audio_00 ! ffdec_aac ! lame bitrate=128 ! queue ! mux. mp4mux name=mux ! filesink location=0000.mp4 –v -e
如何使用相同的命令对音频和视频进行转码?

哦~ 我解决了这个问题。 下一个司令部做得很好

gst-launch-0.10 ffmux_mp4 name=mux ! \
filesink location=0000.mp4 \
filesrc location=./gain_1.mp4 ! qtdemux name=vdemux vdemux.video_00 ! queue ! ffdec_h264 ! videoscale ! 'video/x-raw-yuv, width=640, height=480' ! x264enc ! queue ! mux. \
filesrc location=./gain_1.mp4 ! qtdemux name=ademux ademux.audio_00 ! ffdec_aac ! lame bitrate=128 ! queue ! mux.`

@Lionel.J我想提出两个改进建议:

  • 如果可能,使用gstreamer-1
  • 您的解决方案读取源文件两次。那没必要。此外,执行此操作时,音频和视频流不同步。您可以从qtdemux读取音频和视频流
  • 这是一个管道,它使用gstreamer-1执行作业,并且只读取源一次:

    gst-launch-1.0 -e filesrc location=/path/to/big_buck_bunny_720p_h264.mov ! \
    decodebin name=decode ! \
    videoscale ! 'video/x-raw,width=640,height=480' ! \
    x264enc ! queue ! mp4mux name=mp4mux ! filesink location=0000.mp4 \
    decode. ! audioconvert ! lamemp3enc bitrate=128 ! queue ! mp4mux.
    

    第一个命令的具体问题是什么?@Mathieu_Du下一个消息是当我被要求运行该命令时。=>正在将管道设置为暂停。。。管道正在预滚。。。重新分配延迟。。。刚刚结束。试着把队列放在解复用器的音频垫后面,在ffdec_aac之前,也许?@Mathieu_Du我试着放一个队列。像这样~~~x264enc!队列多路复用器。demux.audio_00!队列ffdec_aac!跛脚~~~~但是,结果是一样的。好吧,我不确定那里发生了什么,你应该在gstreamer 1.0上尝试一下,如果你仍然复制,来在gtsreamer IRC上讨论一下。它给了我:(gst-launch-1.0:5692):gstreamer CRITICAL**:gst\u元素\u从\u uri:断言“gst\u uri\u是有效的(uri))'失败警告:错误管道:语法error@mabg管道应如图所示工作。也许你缺少一个插件。尝试使用
    -v
    运行以了解发生了什么<代码>在运行管道之前导出GST\u DEBUG\u DUMP\u DOT\u DIR=/tmp将导致GST launch在不同时间转储管道。这也有帮助。要将转储文件转换为图片,请运行.dot文件中的一个.png/tmp/dot。。。如果不使用,它似乎可以工作,因为出现了另一个问题,没有元素“x264enc”,但没有语法错误x264enc是GStreamer丑陋插件的一部分。可能您需要单独安装(包gstreamer1.0-plugins-ught-on Debian-like-Linuxes)。