简体   繁体   中英

FFMPEG + V4L2 OPTIONS

I am looking for a way to integrate the parameters of v4l2-ctl on ffmpeg the problem what ffmpeg overwrite v4l2-ctl and I need specific parameter has v4l2-ctl :( my v4l2-ctl commands is :

v4l2-ctl -v width=640,height=480,pixelformat=4 -p 30 -c h264_profile=0,repeat_sequence_header=1

I want to use these parameters to then stream directly with FFMPEG how can I do ?

Thanks !

You can tell FFmpeg to use video4linux2 (v4l2) as an input "device" ( which it treats like a demuxer ). Depending on your device, v4l2 can provide video in several different formats (for example, raw video like yuv420p, or compressed video like h264, possibly via a hardware accelerator). It looks like you are trying to use h264, so you are probably looking for something along these lines:

ffmpeg -f video4linux2 -input_format h264 -video_size 640x480 -framerate 30 -i /dev/video0 out.h264

FFmpeg will tell v4l2 to provide an h264-encoded stream with the given framerate and size as an input to ffmpeg, which will copy the stream into the file out.h264 . You will need to specify your output format and options depending on your use case.

Note: this assumes your input device is /dev/video0 . You can use v4l2-ctl --list-devices to see which devices are available.

It is not clear from the ffmpeg documentation for v4l2 how to provide additional flags (such as h264_profile and repeat_sequence_header ) to v4l2. FFmpeg does provide a multitude of options for encoding, but those may require you to specify a raw video -input_format from v4l2 and use FFmpeg's x264 encoder instead, which could be much slower than a hardware encoder.

Disclaimer: this question probably belongs on Super User or Video Production rather than Stack Overflow, since it only deals with the command-line tool.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM