stuttering

James Linder jam at tigger.ws
Sat Jan 22 04:32:42 UTC 2022



> On 22 Jan 2022, at 3:14 am, James <jam at tigger.ws> wrote:
> 
> 
> 
>> On 21 Jan 2022, at 10:45 pm, Nicolas Dufresne <nicolas at ndufresne.ca> wrote:
>> 
>> Le vendredi 21 janvier 2022 à 14:48 +0800, James via gstreamer-devel a écrit :
>>> Hi
>>> I'm making progress and wonder if someone can guide me:
>>> 
>>> I have a (coded in C, but looks like this) pipeline 
>>> 
>>> #! /bin/bash
>>> 
>>> IP=192.168.5.150
>>> 
>>> gst-launch-1.0 -e -v v4l2src device=/dev/video2 ! \
>>> 	video/x-h264,width=1920,height=1080,framerate=30/1 ! \
>>> 	tee name=vt \
>>> 	at. ! queue ! avenc_aac ! hl.audio \
>>> 	vt. ! h264parse ! queue ! avdec_h264 ! xvimagesink \
>>> 	vt. ! h264parse ! queue ! avdec_h264 ! xvimagesink \
>>> 	vt. ! avdec_h264 ! x264enc tune=zerolatency bitrate=1000 ! \
>> 
>> If I look a the transcoding branch:
>> 
>>  v4l2src ! tee ! avec_h264 ! x264enc ...
>> 
>> This is all running on the same thread, there is likely tones of interblocking
>> going on. Rule of thumb, always add queues right after tee, and avoid any
>> processing that would flow down other branches. This applies to you parser being
>> placed before their queues. You may also split the decoder and the encode on
>> their own stream threads.
>> 
>>> 	h264parse ! hlssink2 max-files=15 name=hl \
>>> 	playlist-root=http://$IP playlist-location=/dev/shm/ch1.m3u8 location=/dev/shm/ch1_%05d.ts \
>>> 	vt. ! h264parse ! queue max-size-buffers=0 max-size-bytes=0 max-size-time=1000000000 ! \
>>> 	mux. \
>>> 	pulsesrc device=0 ! queue ! audioconvert ! \
>>> 	tee name=at \
>>> 	at. ! audioresample ! audio/x-raw, rate=48000 ! \
>>> 	queue ! avenc_aac ! queue ! \
>>> 	mux. mp4mux name=mux ! \
>>> 	filesink location=try6.mp4
>>> 
>>> If I set the camera bitrate to 3Mb/s then everything is good. Files have no dropped frames.
>>> If I set the camera bitrate to 10 Mb/s then playback stutters and frames are dropped.
>>> I each case htop shows cpu usage around 50% on a 4core intel i7.
>>> nmon shows nothing glaringly wrong.
>>> 
>>> Logic says 'turn the record rate down" as per hlssink2 but I can just turn the camera rate down.
>>> If I record at 10 Mb/s using audiotestsrc then recording is fine.
>>> The error messages from pulsesrc are confusing saying "Down stream can't keep up"
>>> 
>>> What might I do to pulsesrc to be like audiotestsrc so that 10 Mb/s recording is OK
> 
> 
> Thanks, not only an answer, but logic too.
> James



More information about the gstreamer-devel mailing list