1

I made a simple animation (as crawl text) using C#-WPF.

The animation is smooth and excellent. (in wpf window)

But when I capture it by FFmpeg as video it has flickering problem.

Please see sample1 (speed of animation is high) and sample2 (speed of animation is low).

Is it field issue or sync problem or ......?

How can I fix it?

UPDATE:

this is my ffmpeg command:

ffmpeg -f gdigrab -i title="Wpfwindow" -framerate 30 -vcodec libx264 out1.mp4 -y

Note: I need to framerate=30 or framerate=25 , because I want to convert the video to PAL and NTSC formats.

Output of console:

ffmpeg version N-76417-gee20354 Copyright (c) 2000-2015 the FFmpeg developers
 built with gcc 5.2.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-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      55.  5.100 / 55.  5.100
  libavcodec     57. 13.102 / 57. 13.102
  libavformat    57. 13.100 / 57. 13.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 14.101 /  6. 14.101
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
[gdigrab @ 000001df9916af40] Found window ooo, capturing 704x537x32 at (0,0)
Input #0, gdigrab, from 'title=Wpfwindow':
  Duration: N/A, start: 1464634804.659289, bitrate: 362576 kb/s
    Stream #0:0: Video: bmp, bgra, 704x537, 362576 kb/s, 29.97 tbr, 1000k tbn, 29.97 tbc
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 000001df9916db40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 000001df9916db40] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
[libx264 @ 000001df9916db40] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=4 threads=12 lookahead_threads=2 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
Output #0, mp4, to 'out1.mp4':
  Metadata:
    encoder         : Lavf57.13.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 704x537, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc57.13.102 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=   16 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A    
frame=   31 fps= 31 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A    
frame=   46 fps= 31 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A    
frame=   61 fps= 30 q=29.0 size=       5kB time=00:00:00.10 bitrate= 375.1kbits/s    
frame=   76 fps= 30 q=29.0 size=      11kB time=00:00:00.60 bitrate= 149.6kbits/s    
frame=   92 fps= 30 q=29.0 size=      22kB time=00:00:01.13 bitrate= 159.7kbits/s    
frame=  107 fps= 30 q=29.0 size=      28kB time=00:00:01.63 bitrate= 141.9kbits/s    
frame=  122 fps= 30 q=29.0 size=      36kB time=00:00:02.13 bitrate= 138.7kbits/s    
frame=  137 fps= 30 q=29.0 size=      44kB time=00:00:02.63 bitrate= 137.4kbits/s    
frame=  152 fps= 30 q=29.0 size=      48kB time=00:00:03.13 bitrate= 126.4kbits/s    
frame=  168 fps= 30 q=29.0 size=      52kB time=00:00:03.67 bitrate= 117.1kbits/s    
frame=  183 fps= 30 q=29.0 size=      55kB time=00:00:04.17 bitrate= 107.7kbits/s    
frame=  188 fps= 30 q=-1.0 Lsize=      74kB time=00:00:06.20 bitrate=  98.1kbits/s    
video:72kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.373045%
[libx264 @ 000001df9916db40] frame I:1     Avg QP:18.54  size:  2426
[libx264 @ 000001df9916db40] frame P:129   Avg QP:15.36  size:   483
[libx264 @ 000001df9916db40] frame B:58    Avg QP:22.37  size:   141
[libx264 @ 000001df9916db40] consecutive B-frames: 52.1% 20.2%  0.0% 27.7%
[libx264 @ 000001df9916db40] mb I  I16..4:  8.8% 88.0%  3.1%
[libx264 @ 000001df9916db40] mb P  I16..4:  0.8%  0.2%  0.2%  P16..4:  1.7%  0.7%  0.3%  0.0%  0.0%    skip:96.1%
[libx264 @ 000001df9916db40] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  2.0%  0.4%  0.0%  direct: 0.0%  skip:97.4%  L0:42.9% L1:46.7% BI:10.5%
[libx264 @ 000001df9916db40] 8x8 transform intra:44.1% inter:38.4%
[libx264 @ 000001df9916db40] coded y,u,v intra: 4.7% 5.2% 3.4% inter: 0.4% 0.4% 0.1%
[libx264 @ 000001df9916db40] i16 v,h,dc,p: 87% 12%  1%  0%
[libx264 @ 000001df9916db40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8% 42% 50%  0%  0%  0%  0%  0%  0%
[libx264 @ 000001df9916db40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 60%  8% 23%  2%  2%  1%  2%  1%  1%
[libx264 @ 000001df9916db40] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001df9916db40] ref P L0: 56.0%  7.0% 17.4% 19.5%
[libx264 @ 000001df9916db40] ref B L0: 84.8% 10.7%  4.5%
[libx264 @ 000001df9916db40] ref B L1: 98.7%  1.3%
[libx264 @ 000001df9916db40] kb/s:93.00
Exiting normally, received signal 2.
  • What's the capture command? – Gyan May 30 '16 at 17:33
  • @Mulvya, ffmpeg -f gdigrab -i title="Wpfwindow" -framerate 30 -vcodec libx264 out1.mp4 -y – Mitra M May 30 '16 at 18:38
  • Ok, show the console output as well. – Gyan May 30 '16 at 18:53
  • Updated the question. – Mitra M May 30 '16 at 19:11
0

framerate should go before -i, as it's telling ffmpeg what the input rate is.

ffmpeg -f gdigrab -framerate 30 -i title="Wpfwindow" -vcodec libx264 out1.mp4 -y
  • Thanks, but had no effect. I've also used -r command : ffmpeg -f gdigrab -framerate 30 -i title="Wpfwindow" -vcodec libx264 -r 30 out1.mp4 -y , But this also does not work. – Mitra M May 30 '16 at 19:20
  • In your first sample, the amount of horizontal motion is not the same each frame. This could be an issue of low rate. Try 60. Don't add -r option, especially a value different than framerate. – Gyan May 30 '16 at 19:27
  • And also try it with full desktop. – Gyan May 30 '16 at 19:28
  • my animation has full framerate (FPS=60). aha ,ok . I'll try with full desktop.Thanks. – Mitra M May 30 '16 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.