mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-28 10:04:37 +08:00
avformat/img2enc: Split rawvideo planes only for fully planar formats
AV_PIX_FMT_FLAG_PLANAR does not exclude semi-planar formats such as
NV12, so they were split into .y/.U/.V files with corrupted chroma:
ffmpeg -f lavfi -i testsrc -frames:v 1 -pix_fmt nv12 \
-c:v rawvideo out.%03d.y
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
1 parent
a3f1b1e87c
commit
246d0da2c1
1 file changed
+6
-1
@@ -106,7 +106,12 @@ static int write_header(AVFormatContext *s)
|
||||
&& !av_strcasecmp(str + 1, "y")
|
||||
&& s->nb_streams == 1
|
||||
&& desc
|
||||
&&(desc->flags & AV_PIX_FMT_FLAG_PLANAR)
|
||||
/* Semi-planar formats such as NV12 keep several
|
||||
* components in one plane, so splitting per
|
||||
* component needs one plane per component.
|
||||
*/
|
||||
&& av_pix_fmt_count_planes(st->codecpar->format)
|
||||
== desc->nb_components
|
||||
&& desc->nb_components >= 3;
|
||||
}
|
||||
img->img_number = img->start_img_number;
|
||||
|
||||
Reference in new issue
Block a user