我正在尝试使用
omxh264enc
对 h264 流进行编码,并在 Lichee Pi、TH1520 上使用 mp4mux
将其混合到 mp4 容器。
这是示例管道:
gst-launch-1.0 filesrc location=test_h264.mp4 ! decodebin \
! rawvideoparse use-sink-caps=true \
! omxh264enc ! h264parse ! mp4mux ! filesink location=t_h264.mp4
但是 GStreamer 记录了这样的错误:
ERROR: from element /GstPipeline:pipeline0/GstMP4Mux:mp4mux0: Could not multiplex stream.
Additional debug info:
../gst/isomp4/gstqtmux.c(5410): gst_qt_mux_add_buffer (): /GstPipeline:pipeline0/GstMP4Mux:mp4mux0:
Buffer has no PTS.
将
mp4mux
更改为 qtmux
会记录相同的错误。我厌倦了设置管道中每个元素的属性,但失败了。
这个问题与 gstreamer mux raw h264 to mp4 相似?.
根据 Raspberry Pi Forum 和 freedesktop GitLab 的说法,自 GStreamer 1.10.x 以来,似乎对
qtmux
对时间戳的要求发生了变化,而 h264parse
和 qtmux
没有满足这些要求。 h264parse
已修复。但 gst-omx 早已死了,已经退役了,也许修改源码也无利可图了。
我的解决方案是使用
avenc_mp4
代替。
gst-launch-1.0 filesrc location=test_h264.mp4 ! decodebin \
! rawvideoparse use-sink-caps=true \
! omxh264enc ! h264parse ! avenc_mp4 ! filesink location=t_h264.mp4
但是GStreamer手册中不建议使用
avenc
,并且它不能复用h265或vp9(matroskamux
也不支持gst-omx)。如果有人提供更好的解决方案来直接修复 gst-omx,我将不胜感激。