Log in

View Full Version : Encoding an almos static cartoon


resle
16th March 2015, 02:50
Hi, I am an almost complete newbie to encoding.

I need to encode a batch of small cartoons in mp4 format for use on the web. They're 2/3 minutes long each one and almost completely static, with no full frame changes and just some character moving a little, and slowly.

Currently I am using ffmpeg with the following parameters but I am getting a 3mb file for a 2 minutes long 512x384 movie, which seems huge to me:

-b:v 192k
-s 512x384

-vcodec libx264
-acodec libmp3lame

-r 24fps
-b 192k

-y
-g 30

-pix_fmt yuv420p


Any suggestion to dramatically reduce the file size?
Thnks

mariush
16th March 2015, 03:49
Reducing the audio bitrate would be a good start. A 2 minute 192kbps audio track would use about 2.8 MB. Switch to AAC 96-112 kbps and see how it goes from there.

smok3
16th March 2015, 04:07
Well, obviously you would not use a bitrate mode, check crf
http://slhck.info/articles/crf

ffmpeg example
ffmpeg -i in -pix_fmt yuv420p -c:a libfdk_aac -vbr 5 -c:v libx264 -preset slow -crf 21 out.mp4

resle
16th March 2015, 05:37
Well, obviously you would not use a bitrate mode, check crf
http://slhck.info/articles/crf

ffmpeg example
ffmpeg -i in -pix_fmt yuv420p -c:a libfdk_aac -vbr 5 -c:v libx264 -preset slow -crf 21 out.mp4


FFMPeg warns me:

Codec AVOption vbr (Variable bit rate mode) specified for output file #0 (E:\desktop\result.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Also, I forgot to specify that audio is almost absent from the movies too. It's a bunch of educational cartoons so it's mostly silence, with some very brief sentences here and there.

I wonder how some 1920x1080 x 120min movies can be compressed down to 800mb ... that led me to believe I could squeeze my pathetic 512x384 x 2min static cartoons in 1mb or less...:(

smok3
16th March 2015, 05:42
test just video first
ffmpeg -i input.mp4 -c:v libx264 -crf 21 -an output.mp4

resle
16th March 2015, 05:59
test just video first
ffmpeg -i input.mp4 -c:v libx264 -crf 21 -an output.mp4


Getting much better but now by fiddling with CRF: even a value of 32 is still acceptable, and results in a 75% file size reduction (!!)

Now I should find a FFMPEG version with libfdk_aac compiled in. No success so far..

smok3
16th March 2015, 06:04
Just use whatever AAC encoder is there. (If you are on *nix/mac: ffmpeg -codecs | grep aac)

resle
16th March 2015, 06:13
Just use whatever AAC encoder is there. (If you are on *nix/mac: ffmpeg -codecs | grep aac)

Thanks for all the help. I wanted to use fdk only because the vbr parameter you suggested wouldn't work with the built-in aac encoder but I found the equivalent now.

smok3
16th March 2015, 08:36
p.s. also probably interesting to test is
-tune animation