Message ID | CAJEJqRxifVuc0mrqEQ62vTfu3jEmW_=9Mncj3Zv=f7GRPGwG1g@mail.gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [FFmpeg-devel] avdevice/v4l2enc: Allow writing non-rawvideos to v4l2 | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On 26/04/2020 19:08, David Manouchehri wrote: > This patch allows you to output non-rawvideos to V4L2, which can be quite > helpful at times when you'd like to offer a compressed source (see example > usage below). > > ffmpeg -vaapi_device /dev/dri/renderD129 -f v4l2 -input_format yuyv422 -i > /dev/video2 -f v4l2 -vf 'format=nv12,hwupload' -c:v h264_vaapi /dev/video4 > > From ce5f0ebd8e1d40b0f876b0d1b0b0cf564389b874 Mon Sep 17 00:00:00 2001 > From: Roger <roger-@users.noreply.github.com> > Date: Sat, 4 Nov 2017 16:32:41 -0400 > Subject: [PATCH] avdevice/v4l2enc: Allow writing h264 to v4l2. > > Signed-off-by: David Manouchehri <david.manouchehri@riseup.net> > --- > libavdevice/v4l2enc.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c > index 1c36f81f90..afbd94f8da 100644 > --- a/libavdevice/v4l2enc.c > +++ b/libavdevice/v4l2enc.c > @@ -47,8 +47,7 @@ static av_cold int write_header(AVFormatContext *s1) > } > > if (s1->nb_streams != 1 || > - s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO || > - s1->streams[0]->codecpar->codec_id != AV_CODEC_ID_RAWVIDEO) { > + s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) { > av_log(s1, AV_LOG_ERROR, > "V4L2 output device supports only a single raw video stream\n"); > return AVERROR(EINVAL); > @@ -56,7 +55,7 @@ static av_cold int write_header(AVFormatContext *s1) > > par = s1->streams[0]->codecpar; > > - v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO); > + v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, s1->streams[0]->codecpar->codec_id); I think you only want NONE for non-RAWVIDEO - the raw formats still need to be mapped. > if (!v4l2_pixfmt) { // XXX: try to force them one by one? > av_log(s1, AV_LOG_ERROR, "Unknown V4L2 pixel format equivalent for %s\n", > av_get_pix_fmt_name(par->format)); > -- > 2.17.1 > Seems like a nice change! Thanks, - Mark
Thanks for catching that bug! I tested rawvideo again this time, and it works as expected with this new patch.
From ce5f0ebd8e1d40b0f876b0d1b0b0cf564389b874 Mon Sep 17 00:00:00 2001 From: Roger <roger-@users.noreply.github.com> Date: Sat, 4 Nov 2017 16:32:41 -0400 Subject: [PATCH] avdevice/v4l2enc: Allow writing h264 to v4l2. Signed-off-by: David Manouchehri <david.manouchehri@riseup.net> --- libavdevice/v4l2enc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c index 1c36f81f90..afbd94f8da 100644 --- a/libavdevice/v4l2enc.c +++ b/libavdevice/v4l2enc.c @@ -47,8 +47,7 @@ static av_cold int write_header(AVFormatContext *s1) } if (s1->nb_streams != 1 || - s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO || - s1->streams[0]->codecpar->codec_id != AV_CODEC_ID_RAWVIDEO) { + s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) { av_log(s1, AV_LOG_ERROR, "V4L2 output device supports only a single raw video stream\n"); return AVERROR(EINVAL); @@ -56,7 +55,7 @@ static av_cold int write_header(AVFormatContext *s1) par = s1->streams[0]->codecpar; - v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO); + v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, s1->streams[0]->codecpar->codec_id); if (!v4l2_pixfmt) { // XXX: try to force them one by one? av_log(s1, AV_LOG_ERROR, "Unknown V4L2 pixel format equivalent for %s\n", av_get_pix_fmt_name(par->format)); -- 2.17.1