Hello FFmpeg developers, I would like to report and understand a compression behavior I am consistently observing with FFmpeg, specifically when using NVENC on MPEG-2 (MPG) sources. Test case summary Input Container: MPG Codec: MPEG-2 (interlaced) Duration: ~19 minutes Size: ~2 GB FPS: 25 Source has no visible combing in original playback 1. CPU (libx264) – Interlaced encode (no yadif) Command:
ffmpeg -y ^ -i "02 SHUKRANA CEREMONY.mpg" ^ -map 0:v:0 -map 0:a:0 ^ -c:v libx264 ^ -flags +ilme+ildct ^ -x264-params tff=1 ^ -crf 25 ^ -preset slow ^ -pix_fmt yuv420p ^ -c:a aac -b:a 192k ^ -movflags +faststart ^ "CPU_interlaced.mp4" Compression worked File size reduced significantly However, horizontal combing lines appeared on only mobile device but it worked nice on PCs 2. CPU (libx264) – Deinterlaced using YADIF Command: ffmpeg -y ^ -i "02 SHUKRANA_1m30s_to_3m30s.mpg" ^ -map 0:v:0 -map 0:a:0 ^ -vf "yadif=1:-1:0" ^ -c:v libx264 ^ -crf 25 ^ -preset slow ^ -profile:v high ^ -level 4.2 ^ -pix_fmt yuv420p ^ -c:a aac -b:a 192k ^ -movflags +faststart ^ "CPU_YADIF.mp4" Result Visual quality: excellent No combing or lines on any device File size: ~900 MB (from ~2 GB) → ~55–60% reduction Encoding time: ~30 minutes for 19 minutes of video 3. GPU (NVENC) – Deinterlaced using YADIF (bob) Command: ffmpeg -y ^ -i "02 SHUKRANA CEREMONY.mpg" ^ -map 0:v:0 -map 0:a? ^ -vf "yadif=mode=1:parity=auto:deint=all" ^ -c:v h264_nvenc ^ -preset p6 ^ -rc vbr ^ -cq 25 ^ -b:v 0 ^ -g 50 ^ -profile:v high ^ -pix_fmt yuv420p ^ -spatial-aq 1 ^ -temporal-aq 1 ^ -aq-strength 7 ^ -c:a aac -ac 2 -b:a 192k ^ -movflags +faststart ^ "NVENC_YADIF.mp4" Result Visual quality: excellent No combing or lines on any device Encoding time: ~6 minutes But output size: ~1.95 GB (only ~500 MB reduction) Key Observation This size inefficiency only happens with MPG / MPEG-2 inputs Other formats (MP4, MTS, MOV, H.264 sources) compress normally with NVENC CPU libx264 consistently achieves much higher compression efficiency on the same MPG sources NVENC appears to allocate significantly more bitrate when: Input codec is MPEG-2 Source is interlaced YADIF bob is applied (FPS doubling) Questions Is this expected behavior due to NVENC hardware limitations with MPEG-2 sources? Does NVENC treat MPEG-2 noise / interlacing conservatively compared to libx264? Are there any recommended NVENC parameters or preprocessing steps to improve compression efficiency for MPEG-2 inputs? Is this a known limitation rather than a bug? Why this matters In production workflows: NVENC is excellent for speed and modern codecs However, for legacy MPG archives, CPU encoding gives far better size efficiency Understanding whether this is expected or tunable would help software decisions Thank you for your work on FFmpeg and for any clarification on this behavior. Best regards, _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
