0

Recently, videos produced by capturing a window on my system using FFmpeg have become choppy/jerky, as if frames have been dropped or duplicated. FFmpeg will sometimes report that a number of frames were dropped when recording began, but not throughout the video. Videos I had recorded a few months ago did not suffer from this. Encoding speed reports to be between 1.0x & 0.996x.

I suspected that the problem might have to do with system performance related to the hard drive. So I cleaned up junk files on my system & defragmented the drive. But the resulting video output did not change.

Reading through this thread, one user recomends recording at 30 fps instead of 60. But I had no problem recording at 60 before.

The dimensions of the window I am recording are 512x448. I record the audio & video in separate FFmpeg processes (this prevents audio drift).

The following is an example portion of a script I use for recording:

ffmpeg -hide_banner -rtbufsize 500M -thread_queue_size 512 -f dshow -ac 1 -i audio="<audio_device>" -c:a pcm_s16le audio-tmp.wav & APID=$!

ffmpeg -hide_banner -rtbufsize 1500M -thread_queue_size 512 -f gdigrab -framerate 60 -i title="<window_name>" -c:v libx264 -preset ultrafast -qp 0 -x264opts keyint="1" video-tmp.mkv

The entire script can be found here.

System specs:

  • HP Pavilion 24-b217c
  • CPU: Intel Core i5-7400T
    • 2.4GHz
    • 4 cores
  • RAM: 12GB
  • GPU (hybrid):
    • NVIDIA GeForce 930MX
    • 2GB dedicated RAM
    • Intel HD Graphics 630

Edit: Here is the video output from the terminal:

Input #0, gdigrab, from 'title=Mega Man Unlimited':
  Duration: N/A, start: 1550055137.876177, bitrate: 440427 kb/s
    Stream #0:0: Video: bmp, bgra, 512x448, 440427 kb/s, 60 fps, 60 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 000001d2881a15c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001d2881a15c0] profile High 4:4:4 Intra, level 3.1, 4:4:4, 8-bit
[libx264 @ 000001d2881a15c0] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=1 keyint_min=1 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'C:/users/antum/Videos/Captures/output-2019-02-13_10.52.17.456113800-video.mkv':
  Metadata:
    encoder         : Lavf58.26.101
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 512x448, q=-1--1, 60 fps, 1k tbn, 60 tbc
    Metadata:
      encoder         : Lavc58.47.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=14587 fps= 60 q=-1.0 Lsize= 1625062kB time=00:04:03.13 bitrate=54753.8kbits/s speed=   1x
video:1624328kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.045149%
[libx264 @ 000001d2881a15c0] frame I:14587 Avg QP: 0.00  size:114027
[libx264 @ 000001d2881a15c0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 000001d2881a15c0] coded y,u,v intra: 46.0% 44.6% 44.6%
[libx264 @ 000001d2881a15c0] i16 v,h,dc,p: 77% 23%  0%  0%
[libx264 @ 000001d2881a15c0] kb/s:54725.45

And here is some of the audio output (output to file):

Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, dshow, from 'audio=Stereo Mix (Realtek High Definition Audio)':
  Duration: N/A, start: 11732.800000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'C:/users/antum/Videos/Captures/output-2019-02-13_10.52.17.456113800-audio.wav':
  Metadata:
    ISFT            : Lavf58.26.101
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
    Metadata:
      encoder         : Lavc58.47.100 pcm_s16le
size=       0kB time=00:00:01.01 bitrate=   0.6kbits/s speed=   2x    
size=       0kB time=00:00:01.51 bitrate=   0.4kbits/s speed= 1.5x    
size=       0kB time=00:00:02.01 bitrate=   0.3kbits/s speed=1.33x    
size=       0kB time=00:00:02.51 bitrate=   0.2kbits/s speed=1.25x    
size=     256kB time=00:00:03.01 bitrate= 696.7kbits/s speed= 1.2x    
size=     256kB time=00:00:03.51 bitrate= 597.7kbits/s speed=1.16x    
size=     256kB time=00:00:04.01 bitrate= 523.0kbits/s speed=1.14x    
size=     256kB time=00:00:04.51 bitrate= 465.1kbits/s speed=1.12x    
size=     256kB time=00:00:05.01 bitrate= 418.6kbits/s speed= 1.1x    
size=     256kB time=00:00:05.51 bitrate= 380.7kbits/s speed=1.09x    
size=     512kB time=00:00:06.01 bitrate= 697.9kbits/s speed=1.09x    
size=     512kB time=00:00:06.51 bitrate= 644.3kbits/s speed=1.08x    
size=     512kB time=00:00:07.01 bitrate= 598.3kbits/s speed=1.07x    
...
...
size=   20224kB time=00:03:55.01 bitrate= 705.0kbits/s speed=   1x    
size=   20224kB time=00:03:55.51 bitrate= 703.5kbits/s speed=   1x    
size=   20224kB time=00:03:56.01 bitrate= 702.0kbits/s speed=   1x    
size=   20224kB time=00:03:56.51 bitrate= 700.5kbits/s speed=   1x    
size=   20224kB time=00:03:57.01 bitrate= 699.0kbits/s speed=   1x    
size=   20224kB time=00:03:57.51 bitrate= 697.5kbits/s speed=   1x    
size=   20480kB time=00:03:58.01 bitrate= 704.9kbits/s speed=   1x    
size=   20480kB time=00:03:58.51 bitrate= 703.4kbits/s speed=   1x    
size=   20480kB time=00:03:59.01 bitrate= 701.9kbits/s speed=   1x    
size=   20480kB time=00:04:00.01 bitrate= 699.0kbits/s speed=   1x    
size=   20480kB time=00:04:00.51 bitrate= 697.6kbits/s speed=   1x    
size=   20736kB time=00:04:01.01 bitrate= 704.8kbits/s speed=   1x    
size=   20736kB time=00:04:01.51 bitrate= 703.4kbits/s speed=   1x    
size=   20736kB time=00:04:02.01 bitrate= 701.9kbits/s speed=   1x    
size=   20736kB time=00:04:02.51 bitrate= 700.5kbits/s speed=   1x    
3
  • Are you using the same ffmpeg as months ago when it worked?
    – llogan
    Commented Feb 13, 2019 at 19:21
  • I have upgraded to a newer version to see if it would fix the problem. Commented Feb 14, 2019 at 23:01
  • If an old version worked and the new one is worse it could indicate a regression. If you are familiar with git bisect and compiling you could find the responsible commit, but it can be time consuming and tedious.
    – llogan
    Commented Feb 14, 2019 at 23:42

0

Your Answer

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

Browse other questions tagged or ask your own question.