NickeManarin / ScreenToGif

🎬 ScreenToGif allows you to record a selected area of your screen, edit and save it as a gif or video.
http://www.screentogif.com
Microsoft Public License
23.92k stars 2.19k forks source link

Can display ffmpeg processing progress? #417

Closed xueyu888 closed 5 years ago

xueyu888 commented 5 years ago

when I use FFmpeg, I can't see the percentage processed, just display processing. so I don't know how long it will take.

Nesh108 commented 5 years ago

Just as a side, it seems that adding -stats to the ffmpeg command works for showing progress. Perhaps STG can use that too?

NickeManarin commented 5 years ago

Done! It's valid for all file types (gif, apng, video).

Since FFmpeg log skips frames, the encoder will skips the percentage too. For example, with this encoding log, FFmpeg processed/read the frames before finally encoding them into a gif.

ffmpeg version N-95111-g87ddf9f1ef Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20190918
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 35.100 / 56. 35.100
  libavcodec     58. 59.100 / 58. 59.100
  libavformat    58. 33.100 / 58. 33.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 59.100 /  7. 59.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, concat, from '.\Temp\ScreenToGif\Recording\2019-09-27 18-17-31\Encode 2019-09-27 06-22-09\concat.txt':
  Duration: 00:00:20.02, start: 0.000000, bitrate: 22 kb/s
    Stream #0:0: Video: png, rgba(pc), 1936x1056 [SAR 3779:3779 DAR 11:6], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (png) -> palettegen
  Stream #0:0 (png) -> paletteuse:default
  paletteuse -> Stream #0:0 (gif)
Press [q] to stop, [?] for help
Output #0, gif, to '.\Desktop\i (1).gif':
  Metadata:
    encoder         : Lavf58.33.100
    Stream #0:0: Video: gif, pal8, 1936x1056 [SAR 1:1 DAR 11:6], q=2-31, 200 kb/s, 25 fps, 100 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc58.59.100 gif
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
[Parsed_palettegen_0 @ 000001f6b8205280] 255(+1) colors generated out of 495475 colors; ratio=0.000515
frame=    2 fps=0.1 q=-0.0 size=     112kB time=00:00:00.05 bitrate=18286.1kbits/s speed=0.00222x    
frame=   24 fps=1.0 q=-0.0 size=     135kB time=00:00:01.09 bitrate=1011.7kbits/s speed=0.0474x    
frame=   38 fps=1.6 q=-0.0 size=     144kB time=00:00:01.73 bitrate= 679.9kbits/s speed=0.0736x    
frame=   44 fps=1.8 q=-0.0 size=     147kB time=00:00:02.01 bitrate= 600.9kbits/s speed=0.0837x    
frame=   53 fps=2.2 q=-0.0 size=     162kB time=00:00:02.41 bitrate= 550.3kbits/s speed=0.0983x    
frame=   78 fps=3.1 q=-0.0 size=     183kB time=00:00:03.57 bitrate= 419.7kbits/s speed=0.143x    
frame=   98 fps=3.8 q=-0.0 size=     210kB time=00:00:04.49 bitrate= 383.2kbits/s speed=0.176x    
frame=  120 fps=4.6 q=-0.0 size=     247kB time=00:00:05.53 bitrate= 365.6kbits/s speed=0.212x    
frame=  135 fps=5.1 q=-0.0 size=     256kB time=00:00:06.21 bitrate= 337.7kbits/s speed=0.234x    
frame=  163 fps=6.0 q=-0.0 size=     256kB time=00:00:07.53 bitrate= 278.5kbits/s speed=0.278x    
frame=  174 fps=6.3 q=-0.0 size=     256kB time=00:00:08.05 bitrate= 260.5kbits/s speed=0.292x    
frame=  187 fps=6.6 q=-0.0 size=     256kB time=00:00:08.61 bitrate= 243.6kbits/s speed=0.306x    
frame=  197 fps=6.9 q=-0.0 size=     256kB time=00:00:09.09 bitrate= 230.7kbits/s speed=0.317x    
frame=  221 fps=7.6 q=-0.0 size=     512kB time=00:00:10.21 bitrate= 410.8kbits/s speed=0.35x    
frame=  243 fps=8.2 q=-0.0 size=     512kB time=00:00:11.21 bitrate= 374.2kbits/s speed=0.378x    
frame=  255 fps=8.5 q=-0.0 size=     512kB time=00:00:11.77 bitrate= 356.4kbits/s speed=0.39x    
frame=  263 fps=8.6 q=-0.0 size=     512kB time=00:00:12.17 bitrate= 344.6kbits/s speed=0.397x    
frame=  287 fps=9.2 q=-0.0 size=     512kB time=00:00:13.25 bitrate= 316.6kbits/s speed=0.425x    
frame=  326 fps= 10 q=-0.0 size=     512kB time=00:00:15.09 bitrate= 278.0kbits/s speed=0.476x    
frame=  341 fps= 11 q=-0.0 size=    1792kB time=00:00:15.89 bitrate= 923.9kbits/s speed=0.492x    
frame=  343 fps= 10 q=-0.0 size=    4352kB time=00:00:16.01 bitrate=2226.8kbits/s speed=0.484x    
frame=  345 fps= 10 q=-0.0 size=    7168kB time=00:00:16.09 bitrate=3649.5kbits/s speed=0.476x    
frame=  347 fps= 10 q=-0.0 size=    9984kB time=00:00:16.21 bitrate=5045.6kbits/s speed=0.47x    
frame=  349 fps=9.9 q=-0.0 size=   12800kB time=00:00:16.33 bitrate=6421.2kbits/s speed=0.463x    
frame=  357 fps= 10 q=-0.0 size=   14080kB time=00:00:16.85 bitrate=6845.3kbits/s speed=0.471x    
frame=  381 fps= 11 q=-0.0 size=   14336kB time=00:00:18.01 bitrate=6520.9kbits/s speed=0.497x    
frame=  423 fps= 12 q=-0.0 Lsize=   14572kB time=00:00:20.01 bitrate=5965.9kbits/s speed=0.545x    
video:14572kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000134%

This is the result, when the encoding starts, FFmpeg analyzes the frames and after a few seconds it starts encoding:

Encoding with FFmpeg