rpicamsrc: Buffer has no PTS

Jan Schmidt thaytan at noraisin.net
Wed Jan 11 10:06:03 UTC 2023


On 11/1/23 19:23, Abu Abdullah wrote:
> On Wed, Jan 11, 2023 at 12:07 PM Jan Schmidt <jan at widgetgrove.com.au> wrote:
>> Hi,
>>
>> On 11/1/23 18:47, Abu Abdullah wrote:
>>> On Wed, Jan 11, 2023 at 10:59 AM Jan Schmidt <jan at widgetgrove.com.au> wrote:
>>>> Hi,
>>>>
>>>> Remove the 'do-timestamp=true' and 'inline-headers=true' from rpicamsrc
>>>>
>>>>     It will apply timestamps automatically, so doesn't need
>>>> `do-timestamp=true`
>>>>
>>>> Sending `inline-headers=true` adds the packets with no timestamps, and
>>>> h264parse isn't removing them - but you don't need inline-headers when
>>>> muxing to mp4.
>>>>
>>>> This works fine:
>>>>
>>>> gst-launch-1.0 -e rpicamsrc preview=false keyframe-interval=30 !
>>>> video/x-h264,width=640,height=480,framerate=30/1,profile=high !
>>>> h264parse ! mp4mux ! filesink location=/tmp/tmp.mp4
>>>>
>>>> Cheers,
>>>>
>>>> Jan.
>>> inline-headers is needed for the hls ts segments not for the mp4mux .
>>> for some reason, hls is not working without it and the browser console
>>> is displaying errors everywhere. not sure if something can be done
>>> from the other side (hls.js module)
>> In that case, use `h264parse config-interval=-1` to re-send the SPS/PPS
>> with keyframes
>>
>> Cheers,
>>
>> Jan.
> It seems it generates the same error:
> $ gst-launch-1.0 rpicamsrc inline-headers=true preview=false
> keyframe-interval=30 !
> video/x-h264,width=640,height=480,framerate=30/1,profile=high !
> h264parse config-interval=-1 ! tee name=t t. ! queue ! splitmuxsink
> location=/home/pi/snapshots_tmp/snap_%03d.mp4
> max-size-time=30000000000 max-size-bytes=2000000 t. ! queue ! hlssink
> max-files=5 target-duration=5
> location=/home/pi/snapshots_tmp/segment_%05d.ts
> playlist-location=/home/pi/snapshots_tmp/playlist.m3u8
> Setting pipeline to PAUSED ...
> Pipeline is live and does not need PREROLL ...
> Pipeline is PREROLLED ...
> Setting pipeline to PLAYING ...
> New clock: GstSystemClock
> Redistribute latency...
> Redistribute latency...
> Redistribute latency...
> Redistribute latency...
> ERROR: from element
> /GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstMP4Mux:muxer:
> Could not multiplex stream.
> Additional debug info:
> ../gst/isomp4/gstqtmux.c(5402): gst_qt_mux_add_buffer ():
> /GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstMP4Mux:muxer:
> Buffer has no PTS.
> Execution ended after 0:00:02.327041279
> Setting pipeline to NULL ...
> Freeing pipeline ...


1) You still have `inline-headers=true` in your command-line

2) You should probably be using hlssink2 instead of hlssink to generate 
your HLS. Failing that, the original hlssink requires the input to be 
muxed MPEG-TS - so put a mpegtsmux in front.

3) If you want to mux to both mp4 via splitmuxsink and MPEG-TS via 
hlssink or hlssink2, you need 2 different representations of the H.264 
stream, so you need a separate h264parse for each one, after the tee.

Something like:

gst-launch-1.0 -e rpicamsrc preview=false
keyframe-interval=30 !
video/x-h264,width=640,height=480,framerate=30/1,profile=high ! tee name=t t. ! queue ! h264parse ! splitmuxsink
location=/home/pi/snapshots_tmp/snap_%03d.mp4
max-size-time=30000000000 max-size-bytes=2000000
t. ! queue ! h264parse config-interval=-1 ! hlssink2
max-files=5 target-duration=5
location=/home/pi/snapshots_tmp/segment_%05d.ts
playlist-location=/home/pi/snapshots_tmp/playlist.m3u8

Cheers,
Jan.



More information about the gstreamer-devel mailing list