使用 gst 将视频从本地文件编码到本地文件

Encoding video with gst from local file to local file

我有一个本地未压缩的.avi 文件,我想对其进行编码。 我试图从 bash:

这样做
"gst-launch-0.10 filesrc location=path/to/file.avi ~ video/x-raw-yuv, width=640, height=480, framerate=30/1, format=I420 ! nv_omx_h264enc quality-level=2 ! mp4mux ! filesink location= path/test.mp4"

或将 'mp4mux' 切换为 'qtmux'。

没有成功,调试输出为"erroneous pipeline: could not link filesrc0 to omxh264enc0"

我需要一些帮助和一些关于语法以及它是如何工作的解释哈哈! 先感谢您! :)

您的管道似乎不正确。试试这个:

gst-launch-0.10 filesrc location=path/to/file.avi caps="video/x-raw-yuv, width=640, height=480, framerate=30/1, format=I420" ! omxh264enc target-bitrate=15000000 control-rate=variable ! video/x-h264,stream-format=byte-stream,profile=high ! h264parse ! mp4mux ! filesink location=path/test.mp4

您可能需要调整比特率、控制速率等以获得所需的结果,但这为您提供了一个起点。