Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#3444 closed task (invalid)

-r not setting frame rate. -vf fps=25 takes 10 times longer to created video.

Reported by: JoeJohnson Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
I am attempting create a working video that just displays picture after picture. Output frame rate seems that it can only be set with the -vf command, but is entirely too processor intensive. My problem is that if I use the -vf command the PC becomes 100% utilized for a very long time.

How to reproduce:
Creates working video at over 10 times the CPU cost:
ffmpeg.exe -r 1 -i Untitled_%09d.png -vf fps=25 -c h264 h264.avi
Creates video quickly (Only LAV seems to play the video. VLC and other players must be able to view the videos.)
ffmpeg.exe -r 1 -i Untitled_%09d.png -c h264 h264.avi

Any assistance will be much appreciated.

Attachments (1)

TestVideoFiles.zip (148.7 KB) - added by JoeJohnson 5 years ago.
pngs that I am using to create a test video.

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by JoeJohnson

pngs that I am using to create a test video.

comment:1 in reply to: ↑ description Changed 5 years ago by cehoyos

Replying to JoeJohnson:

Creates working video at over 10 times the CPU cost:
ffmpeg.exe -r 1 -i Untitled_%09d.png -vf fps=25 -c h264 h264.avi

ffmpeg.exe -r 1 -i Untitled_%09d.png -c h264 h264.avi

Sorry if I misunderstand: Shouldn't the first command line take approximately 25 times as long as the second? Assuming you want to encode ten seconds, the first command line forces libx264 to encode 250 frames, the second one only 10, or do I miss something?

Generally, please always provide your failing command line together with the complete uncut console ouptut for valid tickets on this bug tracker.

comment:2 Changed 5 years ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • Keywords high CPU -r removed

comment:3 follow-up: Changed 5 years ago by JoeJohnson

Yes, I agree that it is encoding 25 times frames and it should take 25 times longer. In a larger video I created it kept the CPU at 100% only 10 times longer. For longer videos my CPU is at 100% for an extended period.

I am not getting an error when I create the video in either case. When I open the video created without "-vf fps=25" in VLC, it does not play properly. I am able to play the video with a codec pack like k-lite, but not with VLC.

The CPU being a 100% makes the computer unusable during encoding. I am looking for a way to shorten this time, or drop the max CPU use to around 80%. The video must also be playable in VLC.

Here is the output when I run the command with "-vf fps=25" (Windows 7):

ffmpeg version N-61050-g2dcaa1b Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar  2 2014 22:07:10 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable
-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-li
ra --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enab
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, image2, from 'Untitled_%09d.png':
  Duration: 00:00:00.40, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, rgb24, 1196x733 [SAR 3779:3779 DAR 1196:733], 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'h264.avi' already exists. Overwrite ? [y/N] y
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0000000000300420] using SAR=1/1
[libx264 @ 0000000000300420] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000000300420] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
Output #0, avi, to 'h264.avi':
  Metadata:
    ISFT            : Lavf55.33.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 1196x733 [SAR 1:1 DAR 1196:733], q=-1--1, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (png -> libx264)
Press [q] to stop, [?] for help
[output stream 0:0 @ 0000000000350ec0] 100 buffers queued in output stream 0:0, something may be wrong.
frame=  226 fps=132 q=-1.0 Lsize=      81kB time=00:00:08.96 bitrate=  74.3kbits/s
video:70kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 15.693309%
[libx264 @ 0000000000300420] frame I:2     Avg QP:14.45  size:  3555
[libx264 @ 0000000000300420] frame P:56    Avg QP:13.64  size:   905
[libx264 @ 0000000000300420] frame B:168   Avg QP:13.06  size:    84
[libx264 @ 0000000000300420] consecutive B-frames:  0.9%  0.0%  0.0% 99.1%
[libx264 @ 0000000000300420] mb I  I16..4:  0.3% 98.2%  1.4%
[libx264 @ 0000000000300420] mb P  I16..4:  0.1%  0.0%  0.3%  P16..4:  0.4%  0.0%  0.0%  0.0%  0.0%    skip:99.2%
[libx264 @ 0000000000300420] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  1.4%  0.0%  0.0%  direct: 0.0%  skip:98.6%  L0:59.1% L1:40.
[libx264 @ 0000000000300420] 8x8 transform intra:88.0% inter:6.1%
[libx264 @ 0000000000300420] coded y,u,v intra: 5.5% 2.4% 3.2% inter: 0.0% 0.0% 0.0%
[libx264 @ 0000000000300420] i16 v,h,dc,p: 44% 47%  9%  0%
[libx264 @ 0000000000300420] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28%  8% 63%  0%  0%  0%  0%  0%  0%
[libx264 @ 0000000000300420] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 14% 37%  6%  7%  4%  4%  5%  2%
[libx264 @ 0000000000300420] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000000300420] ref P L0: 63.6%  6.1% 26.1%  4.2%
[libx264 @ 0000000000300420] ref B L0: 52.0% 46.9%  1.1%
[libx264 @ 0000000000300420] ref B L1: 98.8%  1.2%
[libx264 @ 0000000000300420] kb/s:63.64
Last edited 5 years ago by JoeJohnson (previous) (diff)

comment:4 in reply to: ↑ 3 Changed 5 years ago by cehoyos

  • Priority changed from important to normal
  • Resolution set to invalid
  • Status changed from new to closed

Replying to JoeJohnson:

I am not getting an error when I create the video in either case. When I open the video created without "-vf fps=25" in VLC, it does not play properly.

Please use -vf fps=3 (or a higher value) if you need vlc playback.

I am able to play the video with a codec pack like k-lite, but not with VLC.

The CPU being a 100% makes the computer unusable during encoding. I am looking for a way to shorten this time, or drop the max CPU use to around 80%.

Sorry, I don't think there is anything about the problems you see that can be fixed within FFmpeg.
On a Posix system, you can use nice, I believe there are ways to reduce the priority for Windows tasks.

comment:5 follow-up: Changed 5 years ago by JoeJohnson

Thank you for your replies!

I have found that the -threads command allows me to keep it to only one CPU. This solves my multitasking issues.

Through trial and error I have found that VLC does not play the video correctly if I drop below 10fps. 10fps encodes much faster than than 25fps. I wish that VLC would have played the file correctly at 1fps, but I suppose that is a discussion to be had with VLC developers.

Last edited 5 years ago by JoeJohnson (previous) (diff)

comment:6 in reply to: ↑ 5 Changed 5 years ago by cehoyos

Replying to JoeJohnson:

Through trial and error I have found that VLC does not play the video correctly if I drop below 10fps.

It works fine here with ffmpeg -f lavfi -i testsrc -vf fps=3 out.avi

Note: See TracTickets for help on using tickets.