I have a m2ts video file that contains a h264 video stream and an ac3 audio stream. The quality is not the best, but it is okay, but converting it with ffmpeg without any additional options makes the video interlaced and very ugly with that:

ffmpeg -i input.m2ts output.mkv


ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 6.2.1 (GCC) 20160916 (Red Hat 6.2.1-2)
  configuration: --arch=x86_64 --bindir=/usr/bin --datadir=/usr/share/ffmpeg --disable-debug --disable-static --disable-stripping --enable-avfilter --enable-avresample --enable-bzlib --enable-cuda --enable-cuvid --enable-libnpp --enable-doc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gpl --enable-iconv --enable-libass --enable-libbluray --enable-libcdio --enable-libdc1394 --enable-libebur128 --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libkvazaar --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-libxvid --enable-libzvbi --enable-lzma --enable-nonfree --enable-openal --enable-opencl --enable-nvenc --enable-opengl --enable-postproc --enable-pthreads --enable-sdl2 --enable-shared --enable-version3 --enable-x11grab --enable-xlib --enable-zlib --extra-cflags='-I/usr/include/nvenc -I/usr/include/cuda' --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --prefix=/usr --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mpegts, from 'input.m2ts':
  Duration: 01:15:49.44, start: 0.984822, bitrate: 19636 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 384 kb/s
File 'output.mkv' already exists. Overwrite ? [y/N] y
[libx264 @ 0xf21240] using SAR=1/1
[libx264 @ 0xf21240] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0xf21240] profile High, level 4.0
[libx264 @ 0xf21240] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'output.mkv':
    encoder         : Lavf57.56.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 1k tbn, 25 tbc
      encoder         : Lavc57.64.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, stereo, fltp
      encoder         : Lavc57.64.101 libvorbis
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (ac3 (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help

Additional options, like presets and crf did not change that and I could not find anything on the Internet except that ffmpeg is supposed to always use progressive unless told otherwise. I also tried hardware transcoding on my GPU, which made the transcode much much faster, but the result was about the same, still heavily interlaced video.

ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input.m2ts -c:v hevc_nvenc -preset slow output.mkv

Any idea what might be causing this and how to fix it? Adding -deinterlace helps with the interlacing, but makes the quality worse.

  • FFmpeg will not create interlacing unless told to do so. Show the full console output of your first command.
    – Gyan
    Commented Dec 24, 2016 at 4:53
  • I added the output to the question. Commented Dec 24, 2016 at 10:26

2 Answers 2


The source is interlaced. To deinterlace it, you can use the yadif filter.

To use it with the default values:

ffmpeg -i input.m2ts -vf yadif=parity=auto output.mkv
  • But when watching the input file in VLC, the interlacing is not visible, when watching the output, it looks terrible. Could VLC be automatically deinterlacing the m2ts file but not the mkv produced by ffmpeg? Or why else would the results look like that? Commented Dec 24, 2016 at 10:34
  • 3
    Since source contains interlaced field order, VLC can display it with correct deinterlacing. When converting without a filter, ffmpeg will mark the output as progressive, but it won't actually have been deinterlaced.
    – Gyan
    Commented Dec 24, 2016 at 10:39
  • @Gyan, that comment should be in the answer, it provides a good explanation of what's going on
    – stib
    Commented Aug 28, 2018 at 3:54
  • I get Unable to find a suitable output format for 'yadif=parity=auto' when trying this.
    – landed
    Commented Nov 9, 2019 at 11:41
  • That's a syntax error - double check all arguments and - in front of option names.
    – Gyan
    Commented Nov 9, 2019 at 12:07

You can try deinterlacing it at the decoding step with the following command, via the CUVID deinterlacer:

ffmpeg -hwaccel cuvid -c:v h264_cuvid -deint 2 -drop_second_field 1 \
-i input.m2ts -c:v hevc_nvenc -qp:v 19 -rc:v constqp \
-tune:v hq -preset:v p7 output.mkv

Or better still, the yadif_cuda filter, with NVDEC in use:

ffmpeg -threads 1 -hwaccel nvdec -hwaccel_output_format cuda -i input.m2ts \
-vf 'yadif_cuda=0:-1:0' -c:v hevc_nvenc \
-qp:v 19 -rc:v constqp -tune:v hq -preset:v p7 \
-b:v 0 output.mkv

Note that NVDEC is a true HWAccel, unlike CUVID. Where possible, migrate from CUVID to NVDEC.

Or keep interlacing with the next command:

ffmpeg -i input.m2ts -flags +ildct -c:v hevc_nvenc -preset:v p7 \
-tune:v hq -rc:v constqp -b:v 0 -qp:v 19 output.mkv


  1. The changes above to the encoder, regarding presets, the tune value and selected rate control mode are required as the ffnvcodec package and FFmpeg's NVENC wrapper implementations require valid values to be set. Failure to do so will result in an error: "The specified rc mode is deprecated. Use -rc constqp/cbr/vbr, -tune and -multipass instead" and your transcode will fail.

  2. Interlaced encoding for NVENC is not supported on Turing and above. To encode interlaced content as-is, use a Pascal GPU or lower.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.