[FFmpeg-devel] [PATCH] (for discussion): nvenc: fix wrong aspect ratio for 720x576 and 720x480 resolution

Philip Langdale philipl at overt.org
Wed Feb 15 05:49:37 EET 2017


On Tue, 14 Feb 2017 12:32:07 +0000
Yogender Gupta <ygupta at nvidia.com> wrote:

> Hi Miroslav , Philip,
> 
> We will look at this issue, and provide a fix for the same. Would be
> great to send me and Sumit (also copied here) the command lines that
> you tried and the observations to repro at our end.

Here's the sample from Miroslav - I've stuck it on dropbox.

https://www.dropbox.com/s/1bjyhdzcuv1y357/dvb_mpegts_720x576_sar_nvenc.ts?dl=0

Here is the ffprobe report and the command line:

> >>> INPUT: Stream #0:0[0x401]: Video: mpeg2video (Main)
> >>> ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR
> >>> 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
> >>>
> >>> OUTPUT: Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 
> >>> 0x001B), yuv420p(progressive), 720x576 [SAR 16:11 DAR 20:11], 25 
> >>> fps, 25 tbr, 90k tbn, 50 tbc
> >>>
> >>> COMMAND: ffmpeg -deint adaptive -hwaccel cuvid -c:v mpeg2_cuvid
> >>> -i "in.ts" -y -c:v h264_nvenc -c:a copy -b:v 1M -preset hq -f
> >>> mpegts "out.ts"

and for completeness, Miroslav's analysis:

> I am sure that i know what is going on, NVENC is inserting wrong SPS
> VUI aspect_ratio_idc to h264 packets when you encode at resolution
> 720x576 and 720x480
> 
> AR 16:9 will insert aspect_ratio_idc=4 but it should be
> aspect_ratio_idc=255, sar_width=64, sar_height=45 for 720x576 AR 4:3
> will insert aspect_ratio_idc=2 but it should be aspect_ratio_idc=255,
> sar_width=16, sar_height=15 for 720x576
> 
> MP4 and MKV containers contains correct AR metadata information which
> all players should accept, but TS container has nothing like that so
> it relies on what is inside h264 SPS.

--phil


More information about the ffmpeg-devel mailing list