[FFmpeg-user] multi-threaded video decoding options vs mencoder

Lukas Österreicher lukas.oesterreicher at inode.at
Wed Apr 13 22:51:27 CEST 2011


Hello.

I'm trying to use ffmpeg or mencoder to encode video for the purpose
of streaming to a flash player, which is used inside subsonic.

The current encoding option I am using is:
ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0
-threads 4 -f flv -vcodec libx264 -fpre /var/subsonic/transcode/presets/libx264-ultrafast.ffpreset -
(where o=offset in seconds, s=source file, b=bitrate w=width,
h=height).

This works ok, but since this is running on a NAS box with only has a dual
core atom processor, processing time is limited and it can only do SD
video properly, but I want to be able to stream 720p content.

I tried around and found that when I use mencoder I can encode much faster.
With a 720p h264 video i get 16 fps with ffmpeg and 28(!!) with
mencoder. So I would either like to improve ffmpeg speed or make
mencoder output flash (preferably h264).

Here some sample comments with which i got the mentioned fps speeds:
ffmpeg -i "/share/MD0_DATA/Multimedia/video1.mkv" -b 500k -s 800x448 -acodec libmp3lame -ab 96k -ar 44100 -ac 2 -f avi -vcodec libx264 -threads 4 -fpre /var/subsonic/transcode/presets/libx264-ultrafast.ffpreset "/share/MD0_DATA/Multimedia/video1-ffmpeg.avi"
mencoder "/share/MD0_DATA/Multimedia/video1.mkv" -lavdopts fast:threads=4 -oac mp3lame -lameopts cbr:br=96:mode=1 -srate 44100 -ovc x264 -x264encopts preset=ultrafast:threads=4:bitrate=500 -vf scale=800:448 -of avi -o "/share/MD0_DATA/Multimedia/video1-mencoder.avi"

The big difference between the two is -lavdopts fast:threads=4.
Without that, mencoder is about as slow as ffmpeg.

I hear that ffmpeg does support multi-threaded decoding, but
apparently that is only limited to a small set of video conent.
I get this line with ffmpeg
[h264 @ 0x8d7c940] Cannot parallelize deblocking type 1, decoding such frames in sequential order

However mencoder can somehow decode the same video much better with
the provided lavdopts optins.


So: is there a way to to make ffmpeg decode it the same fast way?

If not, can you help me get mencoder output a flash compatible stream?
Apparently mencoder cannot support mp4 properly (is that right?), but it does support flv.

However when I try to encode flv like this:
mencoder "/share/MD0_DATA/Multimedia/video1.mkv" -of lavf -lavdopts fast:threads=4 -oac faac -faacopts br=96 -channels 2 -srate 44100 -ovc lavc -lavcopts vcodec=flv:vbitrate=500 -vf scale=800:448 -o "/share/MD0_DATA/Multimedia/video1.flv"

I get this error:
[flv @ 0x89b8c60]dimensions not set
Floating point exception

This also happens with the build i am using with provided here:
http://blog.save-privacy.de/index.php?/archives/10-Flash-Videos-mit-dem-Mencoder-erstellen.html
which should work according to the author.

I use the latest git source for my compile.
Maybe the recent version has a problem that an older versions do not?
If so, please tell me which version to use?

(Note: I also had to revert to a November 2010 version of x264 since the latest version
apparently has problems with encoding and often giving out this error:
mencoder: encoder/slicetype.c:1632: x264_rc_analyse_slice: Assertion `cost >= 0' failed.
see http://forum.qnap.com/viewtopic.php?f=45&t=43340&p=192041#p192041 for more details)

Thanx in advance!
Lukas



More information about the ffmpeg-user mailing list