Such an easy question

James Linder jam at tigger.ws
Wed Aug 4 03:05:42 UTC 2021



> On 3 Aug 2021, at 6:26 pm, Yu You via gstreamer-devel <gstreamer-devel at lists.freedesktop.org> wrote:
> 
> Hi
> 
> The pipeline I tested works. Can you try this "mp4mux", or the "mpegtsmux" must be used?
> My webcam outputs raw video so need to be encoded first. 
> You need to change the "device" value for your video and audio devices. For audio, the device info can be found with command "arecord -l"
> Note: I added "queue leaky=downstream" to get rid of the warnings.
> 
> gst-launch-1.0 -e -v v4l2src device=/dev/video0 ! queue ! videoconvert ! x264enc tune=zerolatency  ! h264parse ! queue ! mux. alsasrc device=hw:0,0 provide-clock=false ! queue leaky=downstream ! audioconvert ! avenc_aac ! queue ! mux. mp4mux name=mux ! queue ! filesink location='output.mp4'
> 
> GST version: 1.18.4 (but I am sure it works for early version)
> OS: Ubuntu 18.04
> 
> Good luck.
> 
> Yu
> 
> 
> On Tue, 3 Aug 2021 at 07:56, James Linder via gstreamer-devel <gstreamer-devel at lists.freedesktop.org> wrote:
> > It must be my own naivet. Building from src, debugging led to the simple answer that works. Thanks specially to Nirbheek.
> > 
> > gst-launch-1.0 $@ v4l2src device=/dev/video2 ! queue ! video/x-h264,width=1920,height=1080,framerate=30/1 ! h264parse ! queue max-size-buffers=0 max-size-bytes=0 max-size-time=1000000000 ! mux. pulsesrc device=0 ! audioconvert ! \
> > 
> > audioresample ! audio/x-raw, rate=16000 \
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > 
> > ! queue ! avenc_aac ! queue ! mux. mpegtsmux name=mux ! filesink location='output.mp4'
> 
> I have a a 1:25min file recorded from above! yet today I can record only 25 sec before ‘underflow’
> 
> I went spelunking
> 
> ————————————— on gst-launch -e -m 
> [busy recording]
> time passes
> 
> 
> 
> Got message #189 from element "pulsesrc0" (warning): GstMessageWarning, gerror=(GError)NULL, debug=(string)"gstaudiobasesrc.c\(845\):\ gst_audio_base_src_create\ \(\):\ /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0:\012Dropped\ 3200\ samples.\ This\ is\ most\ likely\ because\ downstream\ can\'t\ keep\ up\ and\ is\ consuming\ samples\ too\ slowly.";
> WARNING: from element /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0: Can't record audio fast enough
> Additional debug info:
> gstaudiobasesrc.c(845): gst_audio_base_src_create (): /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0:
> —————————————————
> 
> 
> so why, with no messages in does pulsesrc suddenly decide ‘underflow’?
> and why a working pipeline suddenly goes tilt?


First thanks to everybody for help and suggestions.

I have a script that works, tested over hours:

jam at ws101:~> cat gst.try18
#! /bin/bash

gst-launch-1.0 $@ v4l2src device=/dev/video2 ! \
	video/x-h264,width=1920,height=1080,framerate=30/1 ! \
	h264parse ! \
	tee name=t \
	t. ! queue ! \
	mux. pulsesrc device=0 ! audio/x-raw, rate=24000 ! \
	queue max-size-buffers=0 max-size-bytes=0 max-size-time=1000000000 ! \
	audioconvert ! \
	audioresample ! audio/x-raw, rate=16000 ! \
	queue ! \
	avenc_aac ! \
	queue ! \
	mux. mpegtsmux name=mux ! \
	filesink location=try18.mp4 \
	t. ! queue ! avdec_h264 ! xvimagesink sync=false \
	t. ! queue ! avdec_h264 ! xvimagesink sync=false

For my app I code it using  pipeline = gst_parse_launch (. . .);

It works a bit then loses audio, flashes a bit, then settles down to a QUIET recording.
htop (on an i3) shows 4 cores at 50-60%

but looking at the video files (ffprobe):

Input #0, mpegts, from 'Channel1.04Aug2021.102821.mp4':
  Duration: 00:04:41.90, start: 3600.000000, bitrate: 6680 kb/s
  Program 1 
    Stream #0:0[0x41]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1[0x42](en): Audio: aac (LC) ([15][0][0][0] / 0x000F), 16000 Hz, stereo, fltp, 121 kb/s

jam at ws101:~> echo 'Input #0, mpegts, from 'try18.mp4':
>   Duration: 01:44:44.51, start: 3600.000000, bitrate: 10415 kb/s
>   Program 1 
>     Stream #0:0[0x41]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
>     Stream #0:1[0x42](en): Audio: aac (LC) ([15][0][0][0] / 0x000F), 16000 Hz, stereo, fltp, 114 kb/s

I programed the card for 10 000K b/s video.

but my app gets 6680 kb/s where as the script gets 10415 kb/s

Is there a metric I can use to measure performance?
I’m reluctant to go and buy a 4core (real) i7 NUC just to prove/disprove the CPU performance. Opinions …

James








More information about the gstreamer-devel mailing list