[FFmpeg-devel] avdevice/v4l2enc: Allow writing non-rawvideos to v4l2

Jan Ekström jeebjp at gmail.com
Mon May 4 17:19:15 EEST 2020


On Sun, Apr 26, 2020 at 11:26 PM David Manouchehri
<david.manouchehri at riseup.net> wrote:
>
> Resubmit of a previous patch, not sure why the diff didn't come through.
> _______________________________________________
>
> @@ -56,7 +55,13 @@  static av_cold int write_header(AVFormatContext *s1)
>
>      par = s1->streams[0]->codecpar;
>
> -    v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
> +    if(s1->streams[0]->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {
> +        v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
> +    }
> +    else {
> +        v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, s1->streams[0]->codecpar->codec_id);
> +    }
> +

Hi,

A small nit. Wouldn't the variable `par` be usable there that was just
created right on top of this if/else structure ? A la `par->codec_id`
instead of poking at s1->streams[0] again?

Otherwise looks good to me, linked this today on IRC as someone needed
to test a v4l2 device they were developing with MJPEG. Didn't work,
but that could be due to our MJPEG encoder adding all the metadata
headers etc into the bit stream.

Best regards,
Jan


More information about the ffmpeg-devel mailing list