[FFmpeg-user] Newbie needs help on capture video/audio using ffmpeg on RPI

Tom Sparks tomasparks.ts at gmail.com
Thu May 14 02:26:10 EEST 2020


On 14/05/2020, Ram Shaffir <ram at ram.sh> wrote:
> Hi Carl,
>
> Got some progress ,however, whenever I use the h264_omx I still get
> low-quality video output compared with libx264 (increasing the bitrate
> didn't do too much), my current command is:
>
> ffmpeg -y -f alsa -thread_queue_size 15000 -ac 2 -itsoffset -0.5 -i hw:1,0
> -f v4l2 -thread_queue_size 15000 -i /dev/video0 -acodec ac3 -ab 51k -s
> 896x504 -r 30 -vcodec h264_omx -b:v 10000K -pix_fmt yuv420p -f mp4
> /usr/ramDisk/h264_omx.mp4 -loglevel debug 2> /usr/ramDisk/h264_omx.mp4.log
>
your version of FFmpeg is very old

<snipped>
> Opening an input file: hw:1,0.
> [alsa @ 0x748310] All info found
> Guessed Channel Layout for Input Stream #0.0 : stereo
> Input #0, alsa, from 'hw:1,0':
>   Duration: N/A, start: 1589402974.746268, bitrate: 1536 kb/s
>     Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536
> kb/s
> Successfully opened the file.
> Parsing a group of options: input url /dev/video0.
> Applying option f (force format) with argument v4l2.
> Applying option thread_queue_size (set the maximum number of queued packets
> from the demuxer) with argument 15000.
> Successfully parsed a group of options.
> Opening an input file: /dev/video0.
> [video4linux2,v4l2 @ 0x75bb30] fd:3 capabilities:84a00001
> [video4linux2,v4l2 @ 0x75bb30] Current input_channel: 0, input_name: HDMI,
> input_std: 0
> [video4linux2,v4l2 @ 0x75bb30] Querying the device for the current frame
> size
> [video4linux2,v4l2 @ 0x75bb30] Setting frame size to 1920x1080
> [video4linux2,v4l2 @ 0x75bb30] The V4L2 driver changed the pixel format from
> 0x32315559 to 0x56595559
> [video4linux2,v4l2 @ 0x75bb30] Trying to set codec:rawvideo pix_fmt:yuv420p
> [video4linux2,v4l2 @ 0x75bb30] The V4L2 driver changed the pixel format from
> 0x32315559 to 0x56595559
> [video4linux2,v4l2 @ 0x75bb30] Trying to set codec:rawvideo pix_fmt:yuv420p
> [video4linux2,v4l2 @ 0x75bb30] The V4L2 driver changed the pixel format from
> 0x32315659 to 0x56595559
> [video4linux2,v4l2 @ 0x75bb30] Trying to set codec:rawvideo pix_fmt:yuv422p
> [video4linux2,v4l2 @ 0x75bb30] The V4L2 driver changed the pixel format from
> 0x50323234 to 0x56595559
> [video4linux2,v4l2 @ 0x75bb30] Trying to set codec:rawvideo pix_fmt:yuyv422
> [video4linux2,v4l2 @ 0x75bb30] All info found
> Input #1, video4linux2,v4l2, from '/dev/video0':
>   Duration: N/A, start: 963.335659, bitrate: 1988671 kb/s
>     Stream #1:0, 1, 1/1000000: Video: rawvideo, 1 reference frame (YUY2 /
> 0x32595559), yuyv422, 1920x1080, 0/1, 1988671 kb/s, 59.94 fps, 59.94 tbr,
> 1000k tbn, 1000k tbc
> Successfully opened the file.

you are not setting up the /dev/video0 input correctly see
<https://trac.ffmpeg.org/wiki/Capture/Webcam>

Let the camera/capture card to the encoding  and save stream with -c:v
copy -c:a copy

> Many thanks again!
> Best,
> RS


More information about the ffmpeg-user mailing list