<p>I've got a final version of a movie I co-produced, ca. 20 minutes in a below 3GB file. There's a few-second-long fragment that needs to be deinterlaced, but I can't do it on a project file before rendering, since the original director/editor is a weirdo, so I have to make do with the version I have.</p>

<p>Therefore I split the movie to isolate the fragment I need to deinterlace, and I intend to concatenate it later on.</p>

<p>I used this advice: <a href="https://askubuntu.com/questions/866186/how-to-get-good-quality-when-converting-digital-video">https://askubuntu.com/questions/866186/how-to-get-good-quality-when-converting-digital-video</a> and it works well, however it results in a 50 fps file instead of 25 fps (which is understandable due to the intricacies of the process, but not compatible with my original file) and quite different quality settings.
How would I formulate the command to get the output file compatible with the source file in order to concatenate? Should it be two-pass to take advantage of 50 fps deinterlacing process?</p>

<p>Thanks in advance, Antoni.</p>

<p>The source file specs are:</p>

<pre><code>Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 75.2 MiB
Duration                                 : 34 s 987 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 18.0 Mb/s
Writing application                      : Lavf57.34.103

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L4.1
Format settings                          : CABAC / 3 Ref Frames
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 3 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 34 s 760 ms
Bit rate mode                            : Variable
Bit rate                                 : 17.9 Mb/s
Maximum bit rate                         : 24.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.346
Stream size                              : 74.3 MiB (99%)
Language                                 : English
Color range                              : Limited
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 34 s 987 ms
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 820 KiB (1%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1
</code></pre>

<p>[Edit 1:]
As per request, my original command and result (I pressed 'q' for quitting, as it takes quite a long time and here's for demonstration purposes only):</p>

<pre><code>C:\Users\Antoni\Videos\zwycięstwo&gt;ffmpeg -i gotowy_na_poprawki.mp4 -vf yadif=1:-1:0,mcdeint=2:1:10 poprawiony_tmp.mp4
ffmpeg version N-79690-g78baa45 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 23.100 / 55. 23.100
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'gotowy_na_poprawki.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.34.103
  Duration: 00:00:34.99, start: 0.016000, bitrate: 18023 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 17941 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 0000000002d609e0] using SAR=1/1
[libx264 @ 0000000002d609e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0000000002d609e0] profile High, level 4.2
[libx264 @ 0000000002d609e0] 264 - core 148 r2694 3b70645 - 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=6 lookahead_threads=1 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
[mp4 @ 0000000002f90020] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'poprawiony_tmp.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.34.103
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 50 fps, 12800 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.38.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.38.100 aac
Stream mapping:
  Stream #0:0 -&gt; #0:0 (h264 (native) -&gt; h264 (libx264))
  Stream #0:1 -&gt; #0:1 (aac (native) -&gt; aac (native))
Press [q] to stop, [?] for help
[snow @ 000000000070dc60] pass:4mv changed:200
[snow @ 000000000070dc60] pass:4mv changed:552400:00:00.49 bitrate=   0.8kbits/s dup=15 drop=0 speed=0.294x
[snow @ 000000000070dc60] pass:4mv changed:144
[snow @ 000000000070dc60] pass:4mv changed:612400:00:00.53 bitrate=   0.7kbits/s dup=15 drop=0 speed=0.146x
[snow @ 000000000070dc60] pass:4mv changed:120
[snow @ 000000000070dc60] pass:4mv changed:639200:00:00.57 bitrate=   0.7kbits/s dup=15 drop=0 speed= 0.1x
[snow @ 000000000070dc60] pass:4mv changed:136
[snow @ 000000000070dc60] pass:4mv changed:501600:00:00.59 bitrate=   0.6kbits/s dup=15 drop=0 speed=0.0851x
frame=   23 fps=2.4 q=-1.0 Lsize=     166kB time=00:00:00.64 bitrate=2122.3kbits/s dup=15 drop=0 speed=0.066x
video:154kB audio:10kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.158849%
[libx264 @ 0000000002d609e0] frame I:1     Avg QP:20.47  size:124507
[libx264 @ 0000000002d609e0] frame P:6     Avg QP:24.42  size:  3213
[libx264 @ 0000000002d609e0] frame B:16    Avg QP:29.37  size:   808
[libx264 @ 0000000002d609e0] consecutive B-frames:  4.3%  8.7%  0.0% 87.0%
[libx264 @ 0000000002d609e0] mb I  I16..4: 22.7% 62.9% 14.4%
[libx264 @ 0000000002d609e0] mb P  I16..4:  1.3%  2.4%  0.0%  P16..4: 10.8%  0.7%  0.4%  0.0%  0.0%    skip:84.3%
[libx264 @ 0000000002d609e0] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8:  8.6%  0.1%  0.0%  direct: 0.0%  skip:91.1%  L0:26.7% L1:72.8% BI: 0.5%
[libx264 @ 0000000002d609e0] 8x8 transform intra:62.4% inter:96.1%
[libx264 @ 0000000002d609e0] coded y,uvDC,uvAC intra: 76.6% 82.7% 58.9% inter: 0.5% 1.1% 0.0%
[libx264 @ 0000000002d609e0] i16 v,h,dc,p: 14% 20% 44% 22%
[libx264 @ 0000000002d609e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 21% 23%  5%  6%  7%  8%  8%  6%
[libx264 @ 0000000002d609e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 27% 11%  6%  8%  8% 10%  6%  4%
[libx264 @ 0000000002d609e0] i8c dc,h,v,p: 47% 24% 21%  9%
[libx264 @ 0000000002d609e0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000002d609e0] ref P L0: 74.5%  9.2% 14.4%  1.9%
[libx264 @ 0000000002d609e0] ref B L0: 79.0% 20.9%  0.0%
[libx264 @ 0000000002d609e0] ref B L1: 98.6%  1.4%
[libx264 @ 0000000002d609e0] kb/s:2725.30
[aac @ 000000000114c640] Qavg: 319.544
</code></pre>

CC BY-SA 4.0
2018-11-13T23:05:43.787Z
BTW, it's best when asking ffmpeg questions to post your ffmpeg command, and the output from the command.
stib
CC BY-SA 4.0
2018-11-14T10:41:58.650Z
thanks, here it is, however as you can see i'm basically asking for an ffmpeg command, mine is clearly wrong.
baskak
<ffmpeg>
How to deinterlace a fragment of a movie and retain the exact original quality with FFmpeg
baskak
# How to deinterlace a fragment of a movie and retain the exact original quality with FFmpeg

(Asked by: username_0 on 2018-11-10)

I've got a final version of a movie I co-produced, ca. 20 minutes in a below 3GB file. There's a few-second-long fragment that needs to be deinterlaced, but I can't do it on a project file before rendering, since the original director/editor is a weirdo, so I have to make do with the version I have.
Therefore I split the movie to isolate the fragment I need to deinterlace, and I intend to concatenate it later on.
I used this advice: https://askubuntu.com/questions/866186/how-to-get-good-quality-when-converting-digital-video and it works well, however it results in a 50 fps file instead of 25 fps (which is understandable due to the intricacies of the process, but not compatible with my original file) and quite different quality settings.
How would I formulate the command to get the output file compatible with the source file in order to concatenate? Should it be two-pass to take advantage of 50 fps deinterlacing process?
Thanks in advance, Antoni.
The source file specs are:
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 75.2 MiB
Duration                                 : 34 s 987 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 18.0 Mb/s
Writing application                      : Lavf57.34.103

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L4.1
Format settings                          : CABAC / 3 Ref Frames
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 3 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 34 s 760 ms
Bit rate mode                            : Variable
Bit rate                                 : 17.9 Mb/s
Maximum bit rate                         : 24.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.346
Stream size                              : 74.3 MiB (99%)
Language                                 : English
Color range                              : Limited
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 34 s 987 ms
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 820 KiB (1%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

[Edit 1:]
As per request, my original command and result (I pressed 'q' for quitting, as it takes quite a long time and here's for demonstration purposes only):
C:\Users\Antoni\Videos\zwycięstwo>ffmpeg -i gotowy_na_poprawki.mp4 -vf yadif=1:-1:0,mcdeint=2:1:10 poprawiony_tmp.mp4
ffmpeg version N-79690-g78baa45 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 23.100 / 55. 23.100
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'gotowy_na_poprawki.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.34.103
  Duration: 00:00:34.99, start: 0.016000, bitrate: 18023 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 17941 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 0000000002d609e0] using SAR=1/1
[libx264 @ 0000000002d609e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0000000002d609e0] profile High, level 4.2
[libx264 @ 0000000002d609e0] 264 - core 148 r2694 3b70645 - 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=6 lookahead_threads=1 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
[mp4 @ 0000000002f90020] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'poprawiony_tmp.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.34.103
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 50 fps, 12800 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.38.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.38.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[snow @ 000000000070dc60] pass:4mv changed:200
[snow @ 000000000070dc60] pass:4mv changed:552400:00:00.49 bitrate=   0.8kbits/s dup=15 drop=0 speed=0.294x
[snow @ 000000000070dc60] pass:4mv changed:144
[snow @ 000000000070dc60] pass:4mv changed:612400:00:00.53 bitrate=   0.7kbits/s dup=15 drop=0 speed=0.146x
[snow @ 000000000070dc60] pass:4mv changed:120
[snow @ 000000000070dc60] pass:4mv changed:639200:00:00.57 bitrate=   0.7kbits/s dup=15 drop=0 speed= 0.1x
[snow @ 000000000070dc60] pass:4mv changed:136
[snow @ 000000000070dc60] pass:4mv changed:501600:00:00.59 bitrate=   0.6kbits/s dup=15 drop=0 speed=0.0851x
frame=   23 fps=2.4 q=-1.0 Lsize=     166kB time=00:00:00.64 bitrate=2122.3kbits/s dup=15 drop=0 speed=0.066x
video:154kB audio:10kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.158849%
[libx264 @ 0000000002d609e0] frame I:1     Avg QP:20.47  size:124507
[libx264 @ 0000000002d609e0] frame P:6     Avg QP:24.42  size:  3213
[libx264 @ 0000000002d609e0] frame B:16    Avg QP:29.37  size:   808
[libx264 @ 0000000002d609e0] consecutive B-frames:  4.3%  8.7%  0.0% 87.0%
[libx264 @ 0000000002d609e0] mb I  I16..4: 22.7% 62.9% 14.4%
[libx264 @ 0000000002d609e0] mb P  I16..4:  1.3%  2.4%  0.0%  P16..4: 10.8%  0.7%  0.4%  0.0%  0.0%    skip:84.3%
[libx264 @ 0000000002d609e0] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8:  8.6%  0.1%  0.0%  direct: 0.0%  skip:91.1%  L0:26.7% L1:72.8% BI: 0.5%
[libx264 @ 0000000002d609e0] 8x8 transform intra:62.4% inter:96.1%
[libx264 @ 0000000002d609e0] coded y,uvDC,uvAC intra: 76.6% 82.7% 58.9% inter: 0.5% 1.1% 0.0%
[libx264 @ 0000000002d609e0] i16 v,h,dc,p: 14% 20% 44% 22%
[libx264 @ 0000000002d609e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 21% 23%  5%  6%  7%  8%  8%  6%
[libx264 @ 0000000002d609e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 27% 11%  6%  8%  8% 10%  6%  4%
[libx264 @ 0000000002d609e0] i8c dc,h,v,p: 47% 24% 21%  9%
[libx264 @ 0000000002d609e0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000002d609e0] ref P L0: 74.5%  9.2% 14.4%  1.9%
[libx264 @ 0000000002d609e0] ref B L0: 79.0% 20.9%  0.0%
[libx264 @ 0000000002d609e0] ref B L1: 98.6%  1.4%
[libx264 @ 0000000002d609e0] kb/s:2725.30
[aac @ 000000000114c640] Qavg: 319.544

**Tags:** ffmpeg

> **Comments:**
> **username_1**: BTW, it's best when asking ffmpeg questions to post your ffmpeg command, and the output from the command.  
> **username_0**: thanks, here it is, however as you can see i'm basically asking for an ffmpeg command, mine is clearly wrong.  

---

## 0 answers

