Body: <p>I have original video with stream record. I need to remove freezes caused by network issues. I notice that sometimes it freezes only video, sometimes video and audio.</p>
  
  <p>I tried to use command:
  <code>ffmpeg -i original.flv -c:v libx264 -crf 23 -preset veryfast -err_detect ignore_err -max_muxing_queue_size 9999 -vf 'setpts=N/FRAME_RATE/TB' -af 'asetpts=N/SAMPLE_RATE/TB' out.mp4</code></p>
  
  <p>As result freezes was removed but audio out of sync. I notice that last 3 seconds of converted video has only audio without video. Original video haven't audio sync issues</p>
  
  <p>Can I remove frames where missed video and audio?</p>
  
  <p>ffmpeg version 4.2.2</p>
  
  <p>ffprobe of original video:</p>
  
  <pre><code>Input #0, flv, from 'original.flv':
    Metadata:
      encoder         : Lavf58.29.100
    Duration: 00:07:37.55, start: 0.000000, bitrate: 3810 kb/s
      Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30.30 fps, 30 tbr, 1k tbn, 60 tbc
      Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 160 kb/s
  </code></pre>
  
  <p>ffprobe of converted video:</p>
  
  <pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.29.100
    Duration: 00:05:31.56, start: 0.000000, bitrate: 3367 kb/s
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 3289 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-09T05:27:09.710Z
Comments.Text: This can't be done. If frames were dropped or lost during recording, they can't be recovered. At best, you can reduce the duration of freezes, as you have done.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-10T02:51:13.113Z
Comments.Text: @Gyan I don't need recover lost frames. My problem is audio out-of-sync after removing freezes using command above
Comments.UserDisplayName: gr8
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-01-14T00:15:13.133Z
Comments.Text: @gr8 Did you find a solution for this?
Comments.UserDisplayName: ScottCate
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-01-16T10:43:52.120Z
Comments.Text: @ScottCate no, not found
Comments.UserDisplayName: gr8
Tags: <ffmpeg><streaming>
Title: Remove freezes in stream record using FFMPEG
UserDisplayName: gr8
ThreadText: # Remove freezes in stream record using FFMPEG
  
  (Asked by: username_0 on 2020-04-09)
  
  I have original video with stream record. I need to remove freezes caused by network issues. I notice that sometimes it freezes only video, sometimes video and audio.
  
  I tried to use command:
  `ffmpeg -i original.flv -c:v libx264 -crf 23 -preset veryfast -err_detect ignore_err -max_muxing_queue_size 9999 -vf 'setpts=N/FRAME_RATE/TB' -af 'asetpts=N/SAMPLE_RATE/TB' out.mp4`
  
  As result freezes was removed but audio out of sync. I notice that last 3 seconds of converted video has only audio without video. Original video haven't audio sync issues
  
  Can I remove frames where missed video and audio?
  
  ffmpeg version 4.2.2
  
  ffprobe of original video:
  
  ```
  Input #0, flv, from 'original.flv':
    Metadata:
      encoder         : Lavf58.29.100
    Duration: 00:07:37.55, start: 0.000000, bitrate: 3810 kb/s
      Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30.30 fps, 30 tbr, 1k tbn, 60 tbc
      Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 160 kb/s
  
  ```
  
  ffprobe of converted video:
  
  ```
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.29.100
    Duration: 00:05:31.56, start: 0.000000, bitrate: 3367 kb/s
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 3289 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  
  ```
  
  **Tags:** ffmpeg, streaming
  
  > **Comments:**
  > **username_1**: This can't be done. If frames were dropped or lost during recording, they can't be recovered. At best, you can reduce the duration of freezes, as you have done.  
  > **username_0**: @username_1 I don't need recover lost frames. My problem is audio out-of-sync after removing freezes using command above  
  > **username_2**: @username_0 Did you find a solution for this?  
  > **username_0**: @username_2 no, not found  
  
  ---
  
  ## 0 answers
  
  