Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ffmpeg speed/quality/size strange behaviour
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Nicias
Guru
Guru


Joined: 06 Dec 2005
Posts: 390

PostPosted: Sat May 11, 2013 1:30 pm    Post subject: ffmpeg speed/quality/size strange behaviour Reply with quote

Hello,

I'm working out transcoding settings for my video collection. Right now it is mostly just uncompressed DVD rips. I decided to look into x264 with ffmpeg. I read this http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide and did some trial runs with a 5 minute video clip.

If I understand it correctly, I should pick a "crf" value that is of sufficent quality, and then pick a "preset" or speed value that gives me the compression time/file size tradeoff I want. I settled on a crf of 17 (supposedly psychovisually transparent) I put together a script to check the compression time/file size of various speeds and I found something strange: Slower speeds didn't produce better compression, in fact after a point, they produced larger files.

I suppose my question is, am I doing something wrong, or is there just little to no point to the slower compression presets? Perhaps it makes more of a difference with a higher crf?

Test script:
Code:
#!/bin/bash
TEMPDIR=/var/tmp/dvd-import/
LOGFILE=speed-log.txt

for x in ultrafast superfast veryfast faster fast medium slow slower veryslow
do

echo "Starting speed=$x-mp3 encoding: " `date` >> ${LOGFILE}
ffmpeg -i input.mkv -c:v libx264 -preset $x -crf 17  -c:a libmp3lame -q:a 0 -ac 2   ${TEMPDIR}$x-17-mp3.mkv
echo "Starting speed=$x-mp3 indexing: " `date` >> ${LOGFILE}
mkvmerge -o $x-17-mp3-index.mkv --engage no_simpleblocks  ${TEMPDIR}$x-17-mp3.mkv
echo "Finished speed=$x-mp3: " `date` >> ${LOGFILE}
echo "Filesize: " `ls $x-17-mp3-index.mkv -lh | cut -d" " -f5` >> ${LOGFILE}

echo "Starting speed=$x encoding: " `date` >> ${LOGFILE}
ffmpeg -i input.mkv -c:v libx264 -preset $x -crf 17  -c:a copy  ${TEMPDIR}$x-17.mkv
echo "Starting speed=$x indexing: " `date` >> ${LOGFILE}
mkvmerge -o $x-17-index.mkv --engage no_simpleblocks  ${TEMPDIR}$x-17.mkv
echo "Finished speed=$x: " `date` >> ${LOGFILE}
echo "Filesize: " `ls $x-17-index.mkv -lh | cut -d" " -f5` >> ${LOGFILE}

done

Resulting log flie
Code:
Starting speed=ultrafast-mp3 encoding:  Fri May 10 19:21:45 EDT 2013
Starting speed=ultrafast-mp3 indexing:  Fri May 10 19:23:06 EDT 2013
Finished speed=ultrafast-mp3:  Fri May 10 19:23:13 EDT 2013
Filesize:  165M
Starting speed=ultrafast encoding:  Fri May 10 19:23:13 EDT 2013
Starting speed=ultrafast indexing:  Fri May 10 19:24:20 EDT 2013
Finished speed=ultrafast:  Fri May 10 19:24:26 EDT 2013
Filesize:  166M
Starting speed=superfast-mp3 encoding:  Fri May 10 19:24:26 EDT 2013
Starting speed=superfast-mp3 indexing:  Fri May 10 19:26:26 EDT 2013
Finished speed=superfast-mp3:  Fri May 10 19:26:31 EDT 2013
Filesize:  109M
Starting speed=superfast encoding:  Fri May 10 19:26:31 EDT 2013
Starting speed=superfast indexing:  Fri May 10 19:28:19 EDT 2013
Finished speed=superfast:  Fri May 10 19:28:23 EDT 2013
Filesize:  110M
Starting speed=veryfast-mp3 encoding:  Fri May 10 19:28:23 EDT 2013
Starting speed=veryfast-mp3 indexing:  Fri May 10 19:31:01 EDT 2013
Finished speed=veryfast-mp3:  Fri May 10 19:31:03 EDT 2013
Filesize:  51M
Starting speed=veryfast encoding:  Fri May 10 19:31:03 EDT 2013
Starting speed=veryfast indexing:  Fri May 10 19:33:28 EDT 2013
Finished speed=veryfast:  Fri May 10 19:33:31 EDT 2013
Filesize:  51M
Starting speed=faster-mp3 encoding:  Fri May 10 19:33:31 EDT 2013
Starting speed=faster-mp3 indexing:  Fri May 10 19:38:12 EDT 2013
Finished speed=faster-mp3:  Fri May 10 19:38:15 EDT 2013
Filesize:  59M
Starting speed=faster encoding:  Fri May 10 19:38:15 EDT 2013
Starting speed=faster indexing:  Fri May 10 19:42:46 EDT 2013
Finished speed=faster:  Fri May 10 19:42:48 EDT 2013
Filesize:  60M
Starting speed=fast-mp3 encoding:  Fri May 10 19:42:48 EDT 2013
Starting speed=fast-mp3 indexing:  Fri May 10 19:49:31 EDT 2013
Finished speed=fast-mp3:  Fri May 10 19:49:33 EDT 2013
Filesize:  63M
Starting speed=fast encoding:  Fri May 10 19:49:33 EDT 2013
Starting speed=fast indexing:  Fri May 10 19:56:06 EDT 2013
Finished speed=fast:  Fri May 10 19:56:08 EDT 2013
Filesize:  64M
Starting speed=medium-mp3 encoding:  Fri May 10 19:56:08 EDT 2013
Starting speed=medium-mp3 indexing:  Fri May 10 20:04:13 EDT 2013
Finished speed=medium-mp3:  Fri May 10 20:04:16 EDT 2013
Filesize:  60M
Starting speed=medium encoding:  Fri May 10 20:04:16 EDT 2013
Starting speed=medium indexing:  Fri May 10 20:12:10 EDT 2013
Finished speed=medium:  Fri May 10 20:12:12 EDT 2013
Filesize:  60M
Starting speed=slow-mp3 encoding:  Fri May 10 20:12:12 EDT 2013
Starting speed=slow-mp3 indexing:  Fri May 10 20:24:00 EDT 2013
Finished speed=slow-mp3:  Fri May 10 20:24:02 EDT 2013
Filesize:  61M
Starting speed=slow encoding:  Fri May 10 20:24:02 EDT 2013
Starting speed=slow indexing:  Fri May 10 20:35:35 EDT 2013
Finished speed=slow:  Fri May 10 20:35:38 EDT 2013
Filesize:  62M
Starting speed=slower-mp3 encoding:  Fri May 10 20:35:38 EDT 2013
Starting speed=slower-mp3 indexing:  Fri May 10 20:58:29 EDT 2013
Finished speed=slower-mp3:  Fri May 10 20:58:31 EDT 2013
Filesize:  60M
Starting speed=slower encoding:  Fri May 10 20:58:31 EDT 2013
Starting speed=slower indexing:  Fri May 10 21:21:10 EDT 2013
Finished speed=slower:  Fri May 10 21:21:12 EDT 2013
Filesize:  60M
Starting speed=veryslow-mp3 encoding:  Fri May 10 21:21:12 EDT 2013
Starting speed=veryslow-mp3 indexing:  Fri May 10 22:02:05 EDT 2013
Finished speed=veryslow-mp3:  Fri May 10 22:02:08 EDT 2013
Filesize:  53M
Starting speed=veryslow encoding:  Fri May 10 22:02:08 EDT 2013
Starting speed=veryslow indexing:  Fri May 10 22:42:53 EDT 2013
Finished speed=veryslow:  Fri May 10 22:42:55 EDT 2013
Filesize:  54M
Back to top
View user's profile Send private message
Maitreya
Apprentice
Apprentice


Joined: 11 Jan 2006
Posts: 221

PostPosted: Wed May 15, 2013 9:03 am    Post subject: Reply with quote

DVD rips come from DVD's (duh) which at most (as i've seen) have MPEG-2 @ 8Mbit.
I guess the sweet spot for that crf is there because quality of the input is limited?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum