I am trying to encode h264 stream with omxh264enc
and mux it to mp4 container with mp4mux
on Lichee Pi, TH1520.
Here is the example pipeline:
gst-launch-1.0 filesrc location=test_h264.mp4 ! decodebin \
! rawvideoparse use-sink-caps=true \
! omxh264enc ! h264parse ! mp4mux ! filesink location=t_h264.mp4
But GStreamer logs such error:
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.
Changing mp4mux
to qtmux
logs the same error. I tired to set properties of every element in the pipeline but failed.
This question is silimar to gstreamer mux raw h264 to mp4?.
According to Raspberry Pi Forum and freedesktop GitLab, it seems that the requirements for
qtmux
on timestamp has been changed since GStreamer 1.10.x, whileh264parse
andqtmux
didn't fulfill those requirements.h264parse
has been fixed. But gst-omx is long dead and has been retired, maybe it is not profitable to modify the source code.My solution is to use
avenc_mp4
instead.But
avenc
is not recommended to use from GStreamer manual, and it cannot mux h265 or vp9 (matroskamux
doesn't support gst-omx as well). I would be appreciated if anyone provides a better solution to fix gst-omx directly.