[FFmpeg-user] Benchmarking with ffmpeg - What are the parameters meaning?

David Wagner david.wagner123 at googlemail.com
Tue Sep 11 14:37:58 CEST 2012


Am 11.09.2012 14:13, schrieb Francois Visagie:
>> -----Original Message-----
>> From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
>> bounces at ffmpeg.org] On Behalf Of David Wagner
>> Sent: 11 September 2012 12:48
>> To: FFmpeg user questions
>> Subject: Re: [FFmpeg-user] Benchmarking with ffmpeg - What are the
>> parameters meaning?
>>
>> Am 11.09.2012 09:38, schrieb Francois Visagie:
>>>> -----Original Message-----
>>>> From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
>>>> bounces at ffmpeg.org] On Behalf Of David Wagner
>>>> Sent: 11 September 2012 00:38
>>>> To: FFmpeg user questions
>>>> Subject: Re: [FFmpeg-user] Benchmarking with ffmpeg - What are the
>>>> parameters meaning?
>>>>
>>>> Am 09.09.2012 23:01, schrieb Carl Eugen Hoyos:
>>>>> David Wagner<david.wagner123<at>    googlemail.com>    writes:
>>>>>
>>>>>> frame= 1065 fps=214 q=-1.0 Lsize=     238kB time=00:00:35.46
>>>>>> bitrate=   55.0kbits/s
>>>>>> bench: utime=8.781s maxrss=49488kB
>>>>>>
>>>>>> What is meant by the fps? Is it the (averaged) speed at which the
>>>>>> frames are processed?
>>>>> No, not averaged but current.
>>>>>
>>>>>> So 1065frames / 214fps = 4,97 s. Which is not equal utime = 8,7818s.
>>>>>> Also I have seen that at the end time=00:00:35.46 is exactly the
>>>>>> length of the encoded video.
>>>>> That is correct and this should be very accurate.
>>>>>
>>>>>> Could someone please explain me the parameters?
>>>>> If you mean frame, size and bitrate, I assumed they are
>>>>> self-explanatory...
>>>>> (I suspect bitrate is also current, not average, but I did not
>>>>> test.) utime is the time spent on CPU, maxrss should be maximum
>>>>> memory footprint.
>>>>>
>>>> I couldn't find much information about theses parameters. Can you
>>>> tell me is utime a good one for comparing codecs?
>>>> What benefit do I have from knowing maximum memory footprint? It
>>>> doesn't seem much informative.
>>>>>> BTW exists there a mode for benchmarking the DEcoding process, so
>>>>>> that I have some stats and won't need to play all the files in
>>>>>> realtime?
>>>>> I always use:
>>>>> $ time ffmpeg -i input -f null -
>>>>>
>>>> Unfortunately I wanted to do the whole process on windows. So I don't
>>>> have time.
>>> It isn't quite clear to me exactly what time lapse you want to
>>> measure. If it's for the whole ffmpeg pass from start to finish, I use
>>> the below on Windows. %INPUT% and %OUTPUT% are set to the input and
>>> output filenames respectively. %PASS% is obviously set to the pass. My
>>> script actually uses a single command line for both passes,
>>> appropriately adjusted for each. So the first time execution passes
>>> through here %PASS% is set to 1 and the 2nd time to 2.
>>>
>>> Hopefully this is of some help.
>>>
>>> echo Start %INPUT%>%OUTPUT%.time.txt
>>>
>>> echo Start pass %PASS%>>%OUTPUT%.time.txt echo. | date | find /v
>>> "Enter the new date: (yy-mm-dd)">>%OUTPUT%.time.txt echo. | time |
>>> find /v "Enter the new time:">>%OUTPUT%.time.txt
>>>
>>> ffmpeg ... -pass %PASS% ...
>>>
>>> echo End pass %PASS%>>%OUTPUT%.time.txt echo. | date | find /v "Enter
>>> the new date: (yy-mm-dd)">>%OUTPUT%.time.txt echo. | time | find /v
>>> "Enter the new time:">>%OUTPUT%.time.txt
>>>
>> Thank you for your script. Can you tell me how I can start it with
> arguments. I
>> don't know the syntax. I tried to give it arguments but it doesn't takes
> them.
>> How can I set e.g. %OUTPUT% from command line?
> My hard-coded DVD MPEG-2 script (called ffmpegencode.bat) is called with
> parameters on the command line e.g.:
> ffmpegencode input.avi 6090000 input.ass
>
> where in this case input.avi is the input file, 6090000 is the requested
> bitrate and input.ass is a subtitle file.
>
> Command line parameters in Windows and DOS are identified inside the script
> as %1, %2 etc. Up to a maximum of 10 I think, then you have to use the
> 'shift' command.
>
> The script sets other values such as %OUTPUT% internally. Here is the full
> script (ffmpeg command not yet updated for presets etc.). Hopefully this
> will give you some idea of how the script uses command line parameters as
> well as the time-stamping commands.
>
> This may not work as is for you esp. when specifying subtitles, in which
> case the script uses Avisynth to inlay them. If you set the external
> environment variable FFMPDBUG to 'echo' before calling the script, i.e.
> set FFMPDBUG=echo
>
> the script prints what it would have done and exits.---

Thank you.
> @echo off
> setlocal
>
> goto INIT
>
> :HELP
> echo.
> echo ffmpegencode v1.6 (c) F. Visagie 2012/08/24
> echo Function: encode PAL DV to DVD-compliant MPEG-2
> echo.
> echo Usage:
> echo ffmpegencode "infile" [bitrate ["subsfile"]] [pass]]]
> echo.
> echo where:
> echo 	"infile"	video file to encode
> echo 	bitrate		set video bitrate in bits/s (default %BITRATE%, max
> %MAXRATE%)
> echo 	"subsfile"	ASS text script with inlay subtitles
> echo 	pass		nothing for uninterrupted 2-pass encoding
> echo 			1 for pass 1 only
> echo 			2 for pass 2 only
> echo.
> echo 	All value parameters accept 0 to indicate default/none
> echo 	To ensure correct processing, double-quote space-separated filenames
> echo 	Encoded output file is named infile%SUFFIX%
> echo.
> echo 	To display commands instead of executing for debugging purposes,
> echo 	set external environment variable FFMPDBUG=echo, otherwise EMPTY
>
> goto ERRPAUSE
>
> rem Version History
> rem v1.1 2009/05/20:	added separate pass 1/2 support
> rem v1.2 2009/05/20:	removed Avisynth input for r19192&  later
> rem v1.3 2009/09/04:	restored Avisynth input for subtitle inlays
> rem v1.4 2010/04/27:	explicitly require quoted filenames, esp. for adding
> subtitles
> rem v1.5 2012/08/14:	updated for ffmpeg version N-43418-g633b90c
> rem			added bitrate parameter
> rem			added copyright tag
> rem 			added DEBUG flag
> rem v1.6 2012/08/24:	changed DEBUG flag to external environment variable
> FFMPDBUG
> rem 			removed built-in denoising
>
> :INIT
> rem Default encode settings
> rem -----------------------
>
> rem Production bitrates
> set BITRATE=6090000
> set MAXRATE=9000000
> set MUXRATE=10080000
>
> rem Bitrates for testing
> rem Following bitrate causes buffer underflow and MuxMan P-STD buffer
> underflow (with -maxrate 9800000)
> rem set BITRATE=9000000
> rem set MAXRATE=9800000
> rem Following muxrate leaves enough room for audio and triggers buffer
> underflow for illegal video
> rem set MUXRATE=9928000
>
> set PSNR=
> rem set PSNR=-psnr
> set SUFFIX=.mpg
> set METADATA=-metadata copyright="Encode (c) Francois Visagie
> francois.visagie at gmail.com"
>
> set INPUT=
> set PASSOPT=
> set SUBSFILE=
>
> REM Parse input file
> if [%1] == [] goto HELP
> if [%1] == [?] goto HELP
> if [%1] == [-?] goto HELP
> if [%1] == [/?] goto HELP
> if [%1] == [h] goto HELP
> if [%1] == [-h] goto HELP
> if [%1] == [/h] goto HELP
> if [%1] == [help] goto HELP
> if [%1] == [-help] goto HELP
> if [%1] == [/help] goto HELP
>
> rem Preserve input filename
> set INPUT=%1
>
> if exist %1. goto QUOTIN
> echo.
> echo Invalid input file %1!
> echo HINT: If it contains spaces, enclose input filename in quotes
>
> :ERRPAUSE
> echo
>
> echo.
> pause
> goto EXIT
>
> :QUOTIN
> rem Ensure input file name quoted
>
> echo %INPUT% | find """">  NUL
> if not errorlevel 1 goto CHKBIT
> set INPUT="%INPUT%"
>
> :CHKBIT
> if [%2] == [] goto CHKOUT
> if [%2] == [0] goto CHKSUBS
> set BITRATE=%2
>
> :CHKSUBS
> if [%3] == [] goto CHKOUT
> if [%3] == [0] goto CHKPASS
> if exist %3. goto QUOTSUBS
> echo.
> echo Invalid subtitle file %3!
> echo HINT: If it contains spaces, enclose subtitle filename in quotes
> goto ERRPAUSE
>
> :QUOTSUBS
> rem Ensure subtitle file name quoted
>
> set SUBSFILE=%3
> echo %SUBSFILE% | find """">  NUL
> if not errorlevel 1 goto CHKPASS
> set SUBSFILE="%SUBSFILE%"
>
> :CHKPASS
> if [%4] == [] goto CHKOUT
> if [%4] == [1] goto SETPASS1
> if [%4] == [2] goto SETPASS2
> echo.
> echo Invalid pass number %4!
> goto ERRPAUSE
>
> :SETPASS1
> set PASSOPT=1
> goto CHKOUT
> :SETPASS2
> set PASSOPT=2
>
> :CHKOUT
> rem Now we're committed and may over-write output file
> set OUTPUT=%INPUT%%SUFFIX%
> if not exist %OUTPUT%. goto MAIN
> echo
>
> echo.
> echo %OUTPUT% already exists!
> echo Press Ctrl-C to abort, else
> echo.
> pause
> goto MAIN
>
> :MISSFILE
> set MISSMESG=Missing pass 1 file (ffmpeg2pass-?.log
> if not [%SUBSFILE%] == [] set MISSMESG=%MISSMESG% or %AVSCRIPT%
> set MISSMESG=%MISSMESG%)!
> echo.
> echo %MISSMESG%
> goto ERRPAUSE
>
>
> :MAIN
>
> set FFINPUT=%INPUT%
> rem Use distinct variable for AVS script to protect input file from
> accidental deletion
> set AVSCRIPT=
>
> if [%SUBSFILE%] == [] goto CHKPASS#
> set FFINPUT=%INPUT%.AVS
> set AVSCRIPT=%FFINPUT%
>
> :CHKPASS#
> if [%PASSOPT%] == [2] goto ENDPASS
>
> set PASS=1
> set VB_STRAT=-b_strategy 1
> if not [%FFMPDBUG%] == [echo] if exist ffmpeg2pass-?.log del
> ffmpeg2pass-?.log
>
> if [%SUBSFILE%] == [] goto LOGSTART
> echo OpenDMLSource(%INPUT%)>%AVSCRIPT%
> echo TextSub(%SUBSFILE%)>>%AVSCRIPT%
>
> if not [%FFMPDBUG%] == [echo] goto LOGSTART
> echo.
> echo %AVSCRIPT%:
> echo.
> type %AVSCRIPT%
> echo.
> del %AVSCRIPT%
>
> :LOGSTART
> if [%FFMPDBUG%] == [echo] goto ENCODE
> echo Start %INPUT%>%OUTPUT%.time.txt
> :BEGNPASS
> if [%FFMPDBUG%] == [echo] goto ENCODE
> echo Start pass %PASS%>>%OUTPUT%.time.txt
> echo. | date | find /v "Enter the new date: (yy-mm-dd)">>%OUTPUT%.time.txt
> echo. | time | find /v "Enter the new time:">>%OUTPUT%.time.txt
>
> :ENCODE
> REM MEncoder reference command line
> rem mencoder -field-dominance 1 -mc 0 -vf hqdn3d=2:1:2,harddup -oac lavc
> -ovc lavc -lavcopts
> abitrate=128:acodec=ac3:autoaspect:ilme:ildct:keyint=15:mbd=2:top=0:trell:vb
> itrate=%BITRATE%:vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vstric
> t=0%PSNR%:vmax_b_frames=2%VB_STRAT%:dia=2:preme=2:predia=2:mbcmp=6:precmp=2:
> cmp=2:subcmp=6:last_pred=2:mv0:mv0_threshold=0 -of mpeg -mpegopts
> format=dvd:muxrate=%MUXRATE%:tsaf %1 -o %OUTPUT%>%OUTPUT%.%PASS%.txt
>
> REM Fast test encode
> rem ffmpeg -y -i %FFINPUT% -target pal-dvd -acodec ac3 -ab 128000 -flags
> ildct+ilme -maxrate %MAXRATE% -vcodec mpeg2video -b:v %BITRATE% -pass %PASS%
> %OUTPUT%
>
> %FFMPDBUG% ffmpeg -y -top 0 -async 0 -i %FFINPUT% -aspect 4:3 -target
> pal-dvd -muxrate %MUXRATE% -acodec ac3 -ab 128000 -flags ildct+ilme+mv0 -g
> 15 -mbd 2 -trellis 1 -bufsize 1835000 -strict 0 -bf 2 %VB_STRAT% -mbcmp 6
> -preme 2 -precmp 2 -pre_dia_size 2 -cmp 2 -dia_size 2 -subcmp 6 -last_pred 2
> -mv0_threshold 0 %PSNR% -maxrate %MAXRATE% -vcodec mpeg2video -b:v %BITRATE%
> -pass %PASS% %METADATA% %OUTPUT%
>
> if [%FFMPDBUG%] == [echo] goto CHKEND
> echo End pass %PASS%>>%OUTPUT%.time.txt
> echo. | date | find /v "Enter the new date: (yy-mm-dd)">>%OUTPUT%.time.txt
> echo. | time | find /v "Enter the new time:">>%OUTPUT%.time.txt
>
> :CHKEND
> if %PASS% == 2 goto END
> if [%PASSOPT%] == [1] goto END
> :ENDPASS
> if not [%FFMPDBUG%] == [echo] if not exist ffmpeg2pass-?.log goto MISSFILE
> if not [%FFMPDBUG%] == [echo] if not [%SUBSFILE%] == [] if not exist
> %AVSCRIPT%. goto MISSFILE
> set PASS=2
> set VB_STRAT=
> goto BEGNPASS
>
>
> :END
> echo
>
> rem pause
>
> if [%PASSOPT%] == [1] goto EXIT
> if exist ffmpeg2pass-?.log del ffmpeg2pass-?.log
> if not [%SUBSFILE%] == [] if exist %AVSCRIPT%. del %AVSCRIPT%
>
> :EXIT
> set MUXRATE=
> set MAXRATE=
> set BITRATE=
> set OUTPUT=
> set PASS=
> set PSNR=
> set SUFFIX=
> set METADATA=
> set VB_STRAT=
> set AVSCRIPT=
> set SUBSFILE=
> set PASSOPT=
> set INPUT=
> set FFINPUT=
> set MISSMESG=
> endlocal
>
> ---
>
>> And what means 'Start pass' (not %Pass%)?
> Start pass %PASS% writes to the text file 'Start pass 1' or 'Start pass 2'
> (depending on value of %PASS%), to distinguish the timestamps of the two
> passes.
>
>> I tried it with replacing with setting the variables in the script.....
>> and it shows me time, but only hh:mm:ss.
> Mine shows "13:54:30.37". I can't be certain but the format is probably
> specified in your computer's date and time settings.
>
>> David
>>>>> Carl Eugen
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>> _______________________________________________
>>> 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
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>



More information about the ffmpeg-user mailing list