Answers.Body: <p>Don't see any frames duplicated. The message you quoted - <em>More than 1000 frames duplicated</em> - is not ffmpeg's analysis of the input. FFmpeg duplicates or drops frames when the input and output framerates differ. You need to use the <a href="https://stackoverflow.com/a/37089629/5726027">mpdecimate</a> filter to remove duplicates in the input:</p>
  
  <pre><code>ffmpeg -i input.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB out.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-27T12:03:29.080Z
Answers.Text: I used above command but voice and video are not sinked
Answers.UserDisplayName: Arash Barari
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-28T04:51:59.507Z
Answers.Text: Use `ffmpeg -i input.mp4 -vf mpdecimate -c:a copy -vsync vfr out.mp4`. The duration will be the same but the duplicate frames will be gone.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-28T06:04:15.460Z
Answers.Text: did not work
  I have a bad problem with DVB mpg recorded files.
  FFMPG can not edit these files.
  [![enter image description here](https://i.sstatic.net/f12Qf.jpg)](https://i.sstatic.net/f12Qf.jpg) I've used above command then video has converted but sound and video not sink
Answers.UserDisplayName: Arash Barari
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-29T17:50:33.297Z
Answers.Text: I tried the solution here and none of them seem to work when you need to trim the video and keep the audio. I found a solution I explained [here](https://stackoverflow.com/a/67322549/283411)
Answers.UserDisplayName: Human
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-19T05:26:56.130Z
Answers.LastActivityDate: 2017-03-19T05:26:56.130Z
Answers.LastEditDate: 2017-05-23T12:40:36.170Z
Answers.UserDisplayName: Gyan
Body: <p>FFmpeg knows about duplicate frames in the input video stream as it outputs a message like this:</p>
  
  <blockquote>
    <p>More than 1000 frames duplicated</p>
  </blockquote>
  
  <p>Is there some way to tell it: "Not include duplicates into the output stream, please?"</p>
  
  <p><strong>EDIT (ADDED):</strong></p>
  
  <p>I tried this command (thanks to <em>Mulvya</em>):</p>
  
  <pre><code>ffmpeg -i scene.mkv -profile:v baseline -level 3.1 -vsync 0 -map 0:v  scene.mp4
  </code></pre>
  
  <p>and obtained the target video <code>scene.mp4</code> with the same duration and (almost) identical in playback with original.</p>
  
  <p>The command with full output of it is here:</p>
  
  <pre><code>&gt;ffmpeg -i scene.mkv -profile:v baseline -level 3.1 -vsync 0 -map 0:v  scene.mp4
  ffmpeg version N-83585-ga5c1c7a Copyright (c) 2000-2017 the FFmpeg developers
    built with gcc 5.4.0 (GCC)
    configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nv
  enc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libblur
  ay --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
  libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-lib
  rtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amr
  wbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enabl
  e-libxvid --enable-libzimg --enable-lzma --enable-zlib
    libavutil      55. 47.100 / 55. 47.100
    libavcodec     57. 80.101 / 57. 80.101
    libavformat    57. 66.102 / 57. 66.102
    libavdevice    57.  2.100 / 57.  2.100
    libavfilter     6. 73.100 /  6. 73.100
    libswscale      4.  3.101 /  4.  3.101
    libswresample   2.  4.100 /  2.  4.100
    libpostproc    54.  2.100 / 54.  2.100
  Input #0, matroska,webm, from 'scene.mkv':
    Metadata:
      encoder         : libmkv 0.6.5
      TITLE           : New Project
      DIRECTOR        : Big Mac
      COMPOSER        : Big Mac
      DESCRIPTION     : This video is about New Project
    Duration: 00:03:11.93, start: 0.000000, bitrate: 1025 kb/s
      Stream #0:0(eng): Video: h264 (High), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 640x480 [SAR 1:1 DAR 4:3], 30 fps, 30 tbr
  , 1k tbn, 180k tbc (default)
      Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
      Stream #0:2(eng): Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s
  [libx264 @ 00000000005c6c40] using SAR=1/1
  [libx264 @ 00000000005c6c40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
  [libx264 @ 00000000005c6c40] profile Constrained Baseline, level 3.1
  [libx264 @ 00000000005c6c40] 264 - core 148 r2762 90a61ec - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.h
  tml - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 t
  rellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
  nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 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, mp4, to 'scene.mp4':
    Metadata:
      DESCRIPTION     : This video is about New Project
      TITLE           : New Project
      DIRECTOR        : Big Mac
      COMPOSER        : Big Mac
      encoder         : Lavf57.66.102
      Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 30 fps, 15360 tbn, 30
   tbc (default)
      Metadata:
        encoder         : Lavc57.80.101 libx264
      Side data:
        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (h264 (native) -&gt; h264 (libx264))
  Press [q] to stop, [?] for help
  frame= 4602 fps=185 q=-1.0 Lsize=   10688kB time=00:03:11.90 bitrate= 456.3kbits/s speed= 7.7x
  video:10651kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.349428%
  [libx264 @ 00000000005c6c40] frame I:24    Avg QP:20.07  size: 27706
  [libx264 @ 00000000005c6c40] frame P:4578  Avg QP:21.30  size:  2237
  [libx264 @ 00000000005c6c40] mb I  I16..4: 20.4%  0.0% 79.6%
  [libx264 @ 00000000005c6c40] mb P  I16..4:  2.0%  0.0%  2.4%  P16..4: 22.9%  4.2%  1.3%  0.0%  0.0%    skip:67.3%
  [libx264 @ 00000000005c6c40] coded y,uvDC,uvAC intra: 47.9% 84.7% 30.2% inter: 4.5% 23.4% 0.6%
  [libx264 @ 00000000005c6c40] i16 v,h,dc,p: 36% 26% 11% 26%
  [libx264 @ 00000000005c6c40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 23% 13%  5%  7%  8%  5%  5%  3%
  [libx264 @ 00000000005c6c40] i8c dc,h,v,p: 39% 26% 27%  8%
  [libx264 @ 00000000005c6c40] ref P L0: 82.8% 10.5%  6.7%
  [libx264 @ 00000000005c6c40] kb/s:454.58
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T12:43:03.210Z
Comments.Text: Without any details, my guess would be to add `-vsync 0` as an output option.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T16:19:27.727Z
Comments.Text: @Mulvya - Thanks - by your answer it seems that I misunderstood the cited message. It probably says about duplicated time stamps and not about identical frames - which is my problem. I have many groups of identical frames and my goal is to put only 1 exemplar of successive identical frames into the output stream.
Comments.UserDisplayName: MarianD
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T16:30:00.570Z
Comments.Text: @Mulvya - To be honest I don't know if I *really* have groups of identical frames - I deducted it only from playback of the video. Your `-vsync 0` didn't help.
Comments.UserDisplayName: MarianD
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T16:44:44.743Z
Comments.Text: Need to see command and full console log.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T18:56:43.903Z
Comments.Text: @Mulvya - Thank for your goodwill, I added them into my question.
Comments.UserDisplayName: MarianD
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T19:14:27.993Z
Comments.Text: Don't see any frames duplicated. BTW, the message you quoted - *More than 1000 frames duplicated* - is not ffmpeg's analysis of the input. ffmpeg duplicates or drops frames when the input and output framerates differ. You need to use the [mpdecimate](http://stackoverflow.com/a/37089629/5726027) filter to remove duplicates in the input.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T20:38:26.617Z
Comments.Text: @Mulvya Yes, it is **precisely what I need**, thank you **very, very much!** I'm glad to have opportunity upvote at least that your answer (but I'll upvote this, too, if you rewrite it as an answer).
Comments.UserDisplayName: MarianD
Tags: <ffmpeg>
Title: FFmpeg - dropping duplicate frames
UserDisplayName: MarianD
ThreadText: # FFmpeg - dropping duplicate frames
  
  (Asked by: username_0 on 2017-03-18)
  
  FFmpeg knows about duplicate frames in the input video stream as it outputs a message like this:
  
  > More than 1000 frames duplicated
  
  Is there some way to tell it: "Not include duplicates into the output stream, please?"
  
  **EDIT (ADDED):**
  
  I tried this command (thanks to *Mulvya*):
  
  ```
  ffmpeg -i scene.mkv -profile:v baseline -level 3.1 -vsync 0 -map 0:v  scene.mp4
  
  ```
  
  and obtained the target video `scene.mp4` with the same duration and (almost) identical in playback with original.
  
  The command with full output of it is here:
  
  ```
  >ffmpeg -i scene.mkv -profile:v baseline -level 3.1 -vsync 0 -map 0:v  scene.mp4
  ffmpeg version N-83585-ga5c1c7a Copyright (c) 2000-2017 the FFmpeg developers
    built with gcc 5.4.0 (GCC)
    configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nv
  enc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libblur
  ay --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
  libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-lib
  rtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amr
  wbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enabl
  e-libxvid --enable-libzimg --enable-lzma --enable-zlib
    libavutil      55. 47.100 / 55. 47.100
    libavcodec     57. 80.101 / 57. 80.101
    libavformat    57. 66.102 / 57. 66.102
    libavdevice    57.  2.100 / 57.  2.100
    libavfilter     6. 73.100 /  6. 73.100
    libswscale      4.  3.101 /  4.  3.101
    libswresample   2.  4.100 /  2.  4.100
    libpostproc    54.  2.100 / 54.  2.100
  Input #0, matroska,webm, from 'scene.mkv':
    Metadata:
      encoder         : libmkv 0.6.5
      TITLE           : New Project
      DIRECTOR        : Big Mac
      COMPOSER        : Big Mac
      DESCRIPTION     : This video is about New Project
    Duration: 00:03:11.93, start: 0.000000, bitrate: 1025 kb/s
      Stream #0:0(eng): Video: h264 (High), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 640x480 [SAR 1:1 DAR 4:3], 30 fps, 30 tbr
  , 1k tbn, 180k tbc (default)
      Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
      Stream #0:2(eng): Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s
  [libx264 @ 00000000005c6c40] using SAR=1/1
  [libx264 @ 00000000005c6c40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
  [libx264 @ 00000000005c6c40] profile Constrained Baseline, level 3.1
  [libx264 @ 00000000005c6c40] 264 - core 148 r2762 90a61ec - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.h
  tml - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 t
  rellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
  nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 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, mp4, to 'scene.mp4':
    Metadata:
      DESCRIPTION     : This video is about New Project
      TITLE           : New Project
      DIRECTOR        : Big Mac
      COMPOSER        : Big Mac
      encoder         : Lavf57.66.102
      Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 30 fps, 15360 tbn, 30
   tbc (default)
      Metadata:
        encoder         : Lavc57.80.101 libx264
      Side data:
        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
  Stream mapping:
    Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Press [q] to stop, [?] for help
  frame= 4602 fps=185 q=-1.0 Lsize=   10688kB time=00:03:11.90 bitrate= 456.3kbits/s speed= 7.7x
  video:10651kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.349428%
  [libx264 @ 00000000005c6c40] frame I:24    Avg QP:20.07  size: 27706
  [libx264 @ 00000000005c6c40] frame P:4578  Avg QP:21.30  size:  2237
  [libx264 @ 00000000005c6c40] mb I  I16..4: 20.4%  0.0% 79.6%
  [libx264 @ 00000000005c6c40] mb P  I16..4:  2.0%  0.0%  2.4%  P16..4: 22.9%  4.2%  1.3%  0.0%  0.0%    skip:67.3%
  [libx264 @ 00000000005c6c40] coded y,uvDC,uvAC intra: 47.9% 84.7% 30.2% inter: 4.5% 23.4% 0.6%
  [libx264 @ 00000000005c6c40] i16 v,h,dc,p: 36% 26% 11% 26%
  [libx264 @ 00000000005c6c40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 23% 13%  5%  7%  8%  5%  5%  3%
  [libx264 @ 00000000005c6c40] i8c dc,h,v,p: 39% 26% 27%  8%
  [libx264 @ 00000000005c6c40] ref P L0: 82.8% 10.5%  6.7%
  [libx264 @ 00000000005c6c40] kb/s:454.58
  
  ```
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: Without any details, my guess would be to add `-vsync 0` as an output option.  
  > **username_0**: @Mulvya - Thanks - by your answer it seems that I misunderstood the cited message. It probably says about duplicated time stamps and not about identical frames - which is my problem. I have many groups of identical frames and my goal is to put only 1 exemplar of successive identical frames into the output stream.  
  > **username_0**: @Mulvya - To be honest I don't know if I *really* have groups of identical frames - I deducted it only from playback of the video. Your `-vsync 0` didn't help.  
  > **username_1**: Need to see command and full console log.  
  > **username_0**: @Mulvya - Thank for your goodwill, I added them into my question.  
  > **username_1**: Don't see any frames duplicated. BTW, the message you quoted - *More than 1000 frames duplicated* - is not ffmpeg's analysis of the input. ffmpeg duplicates or drops frames when the input and output framerates differ. You need to use the [mpdecimate](http://stackoverflow.com/a/37089629/5726027) filter to remove duplicates in the input.  
  > **username_0**: @Mulvya Yes, it is **precisely what I need**, thank you **very, very much!** I'm glad to have opportunity upvote at least that your answer (but I'll upvote this, too, if you rewrite it as an answer).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-03-19. Score: 18 | Accepted answer
  
  Don't see any frames duplicated. The message you quoted - *More than 1000 frames duplicated* - is not ffmpeg's analysis of the input. FFmpeg duplicates or drops frames when the input and output framerates differ. You need to use the [mpdecimate](https://stackoverflow.com/a/37089629/5726027) filter to remove duplicates in the input:
  
  ```
  ffmpeg -i input.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB out.mp4
  
  ```
  
  > **Comments:**
  > **username_2**: I used above command but voice and video are not sinked  
  > **username_1**: Use `ffmpeg -i input.mp4 -vf mpdecimate -c:a copy -vsync vfr out.mp4`. The duration will be the same but the duplicate frames will be gone.  
  > **username_2**: did not work I have a bad problem with DVB mpg recorded files. FFMPG can not edit these files. [![enter image description here](https://i.sstatic.net/f12Qf.jpg)](https://i.sstatic.net/f12Qf.jpg) I've used above command then video has converted but sound and video not sink  
  > **username_3**: I tried the solution here and none of them seem to work when you need to trim the video and keep the audio. I found a solution I explained [here](https://stackoverflow.com/a/67322549/283411)  
  
  ---
  
  