[FFmpeg-user] ffmpeg extremely high consumption

En Figureo Canal figureo56.com at gmail.com
Sun Jun 14 01:17:51 CEST 2015


Since I'm new to video and ffmpeg, I would like to know if something I
noticed is correct. Please correct me if I'm wrong since I'm trying to
learn about ffmpeg, encoding, etc for a project I started working on.

Noticed that, after Henk's reply, if I use -vcodec copy then the output
will "copy" the source video's attribute (-vb, size, etc...), but, if I
really need to set the video rate (-vb) then I need to specify the codec
needed to encode the new video.

Since, internet bandwidth is an issue where I will be deploying the
project, I'm forced to limit every video to about 2M max so, I have to
specify the codec resulting that into high cpu usage. I upgraded to a newer
x264 version and the difference in cpu stress isn't that much.

Also, I don't know what type of video and the quality at 2mbps I'm going to
have as output. Tried encoding a video originally with 4M rate changing it
to 2M and the video freezes from time to time, don't know if is really the
feed or the server itself.

Thanks you guys, once again, for your time.


On Sat, Jun 13, 2015 at 6:09 PM, En Figureo Canal <figureo56.com at gmail.com>
wrote:

> Thanks Henk for your reply, I just learned something new with your post.
>
> Didn't know -crf would override -vb. I know the source video was encoded
> with x264 but, had other videos in different format. But, is great to know
> that tip before feeding videos.
>
> Thanks a lot.
>
> On Sat, Jun 13, 2015 at 10:04 AM, Henk D. Schoneveld <belcampo at zonnet.nl>
> wrote:
>
>>
>> On 13 Jun 2015, at 15:42, En Figureo Canal <figureo56.com at gmail.com>
>> wrote:
>>
>> > On Sat, Jun 13, 2015 at 8:08 AM, Moritz Barsnick <barsnick at gmx.net>
>> wrote:
>> >
>> >> Hi En,
>> >>
>> >> On Fri, Jun 12, 2015 at 14:23:24 -0400, En Figureo Canal wrote:
>> >>> Now, what other options are there using libx264, if any?
>> >>
>> >> Well, have you read my email? Why do I go to the trouble of writing
>> >> those things if you don't engage with it.
>> >>
>> >> E.g.:
>> >>
>> >>>> If you showed us the complete, uncut output, we could see what the
>> >>>> specs of your streams are and whether something is wrong. This way,
>> >>>> without more info, we don't even know which resolution your material
>> >>>> has.
>> >>
>> >> Have you shown us your uncut console output?
>> >>
>> >> And:
>> >>
>> >>>> - use a different preset (e.g. "-preset fast")
>> >>>> and experiment with both.
>> >>>> You could even copy the input stream, if its specs are sufficient.
>> That
>> >>>> reduces CPU significantly.
>> >>
>> >> Have you tried these things? What have you experimented? If the "fast"
>> >> preset doesn't suffice, try "ultrafast". Honestly, there can be a large
>> >> CPU difference. (I have achieved 3x from "faster" to "ultrafast" with
>> >> SD TV material.)
>> >>
>> >> Another thing: Is your libx264 and ffmpeg compiled with proper yasm
>> >> support?
>> >>
>> >> Moritz
>> >>
>> >> A: Because it messes up the order in which people normally read text.
>> >> Q: Why is top-posting such a bad thing?
>> >> A: Top-posting.
>> >> Q: What is the most annoying thing in e-mail?
>> >> _______________________________________________
>> >> ffmpeg-user mailing list
>> >> ffmpeg-user at ffmpeg.org
>> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> >>
>> >
>> >
>> > Thank you Moritz Barsnick for replying again and taking your time to
>> help
>> > me out with my problem.
>> >
>> > I do read your emails, if I'm top posting please pardon me. Gmail input
>> is
>> > what might be top posting.
>> >
>> > I experimented using "ultrafast" and indeed lowered the cpu stress to
>> 50%
>> > which is a great improvement this is how I run the command:
>> >
>> > ffmpeg -re -i /video.mp4 -vcodec libx264 -s 640x360 -vb 1024k -crf 23
>> > -preset ultrafast -pix_fmt yuv420p -maxrate 1256k -bufsize 1256k -ab
>> 96k -f
>> > flv rtmp://ip/live/test
>> >
>> > And this is the output:
>> >
>> > ffmpeg version 2.5.4 Copyright (c) 2000-2015 the FFmpeg developers
>> >  built on Apr 27 2015 21:49:23 with gcc 4.7 (Debian 4.7.2-5)
>> >  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static
>> > --extra-cflags=-I/root/ffmpeg_build/include
>> > --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-gpl
>> > --enable-libass --enable-libfdk-aac --enable-libfreetype
>> > --enable-libmp3lame --enable-libopus --enable-libtheora
>> --enable-libvorbis
>> > --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
>> >  libavutil      54. 15.100 / 54. 15.100
>> >  libavcodec     56. 13.100 / 56. 13.100
>> >  libavformat    56. 15.102 / 56. 15.102
>> >  libavdevice    56.  3.100 / 56.  3.100
>> >  libavfilter     5.  2.103 /  5.  2.103
>> >  libswscale      3.  1.101 /  3.  1.101
>> >  libswresample   1.  1.100 /  1.  1.100
>> >  libpostproc    53.  3.100 / 53.  3.100
>> > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/video.mp4':
>> >  Metadata:
>> >    major_brand     : mp42
>> >    minor_version   : 0
>> >    compatible_brands: isommp42
>> >    creation_time   : 2015-03-03 16:28:42
>> >  Duration: 01:41:30.90, start: 0.000000, bitrate: 712 kb/s
>> >    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
>> > 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 638 kb/s, 29.97 fps,
>> > 29.97 tbr, 30k tbn, 59.94 tbc (default)
>> If you look at the line above you see that your source already is h264,
>> and the bitrate being 712kb/s.
>> So encoding doesn’t make sense, at least not to me. -vcodec copy should
>> result in almost no CPU consuming at all.
>> Beside that -vb 1024k followed by -crf 23 also doesn’t make sense, the
>> last overrules the former, -crf  ’takes’ what it needs for that quality
>> thereby ignoring -vb #
>> Further the used x264 library is from 2012, the last binary is from 24
>> feb 2015, r2538 121396c, the newer versions will be more efficient.
>> >    Metadata:
>> >      handler_name    : VideoHandler
>> >    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
>> mono,
>> > fltp, 72 kb/s (default)
>> >    Metadata:
>> >      creation_time   : 2015-03-03 16:29:33
>> >      handler_name    : IsoMedia File Produced by Google, 5-11-2011
>> > [libx264 @ 0x255e260] using SAR=1/1
>> > [libx264 @ 0x255e260] using cpu capabilities: MMX2 SSE2Slow SlowCTZ
>> > [libx264 @ 0x255e260] profile Constrained Baseline, level 3.0
>> > [libx264 @ 0x255e260] 264 - core 123 r2189 35cf912 - H.264/MPEG-4 AVC
>> codec
>> > - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options:
>> cabac=0
>> > ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00
>> > mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0
>> deadzone=21,11
>> > fast_pskip=1 chroma_qp_offset=0 threads=3 sliced_threads=0 nr=0
>> decimate=1
>> > interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0
>> > keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc_lookahead=0
>> rc=crf
>> > mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1256
>> > vbv_bufsize=1256 crf_max=0.0 nal_hrd=none ip_ratio=1.40 aq=0
>> > Output #0, flv, to 'rtmp://69.64.49.252/live/test':
>> >  Metadata:
>> >    major_brand     : mp42
>> >    minor_version   : 0
>> >    compatible_brands: isommp42
>> >    encoder         : Lavf56.15.102
>> >    Stream #0:0(und): Video: h264 (libx264) ([7][0][0][0] / 0x0007),
>> > yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 1024 kb/s, 29.97 fps, 1k
>> tbn,
>> > 29.97 tbc (default)
>> >    Metadata:
>> >      handler_name    : VideoHandler
>> >      encoder         : Lavc56.13.100 libx264
>> >    Stream #0:1(und): Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002),
>> > 44100 Hz, mono, fltp, 96 kb/s (default)
>> >    Metadata:
>> >      creation_time   : 2015-03-03 16:29:33
>> >      handler_name    : IsoMedia File Produced by Google, 5-11-2011
>> >      encoder         : Lavc56.13.100 libmp3lame
>> > Stream mapping:
>> >  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
>> >  Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))
>> > _______________________________________________
>> > ffmpeg-user mailing list
>> > ffmpeg-user at ffmpeg.org
>> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>
>


More information about the ffmpeg-user mailing list