PDA

View Full Version : Question about encoding MPEG2 with ffmpeg.


maxfu
18th January 2007, 08:49
How to use ffmpeg commandline encoding tool to encode high quality files. Is my commandline good enough?

My commandline:

ffmpeg.exe -i "D:\Video\Fearless\Fearless.avi" -target film-dvd -s 720x352 -padtop 64 -padbottom 64 -maxrate 7350000 -b 3700000 -sc_threshold 1000000000 -trellis -cgop -g 12 -bf 2 -qblur 0.3 -qcomp 0.7 -me full -dc 10 -mbd 2 -aspect 16:9 -pass 1 -passlogfile "D:\Video\ffmpegencode" -an -f mpeg2video "D:\Fearless.m2v"

ffmpeg.exe -i "D:\Video\Fearless\Fearless.avi" -target film-dvd -s 720x352 -padtop 64 -padbottom 64 -maxrate 7350000 -b 3700000 -sc_threshold 1000000000 -trellis -cgop -g 12 -bf 2 -qblur 0.3 -qcomp 0.7 -me full -dc 10 -mbd 2 -aspect 16:9 -pass 2 -passlogfile "D:\Video\ffmpegencode" -an -f mpeg2video "D:\Fearless.m2v"

This setting can encode at a speed of 40fps on my computer.

What do -qblur and -qcomp mean?
And why is the output file still OGOP file?
Is there any GUI for ffmpeg to encode to MPEG2 files?

MPEG2 encoding is really an interesting thing. I used to encode with TMPG, but there is a problem. It is not free. I have to pay for the MPEG2 encoder of TMPG. And it is not fast enough. So several months ago, I tried mencoder. It is fast. But it doesn't obey my my maxbitrate setting. The maxbitrate of the output file is too high for my Pioneer standard DVD Player. Then I tried QuEnc. To be honest it is really really good. It is faster than TMPG and it obeys the maxbitrate setting. But it is still not fast enough to encode high quality files with trellis matrix. Finally I found ffmpeg, the core of QuEnc. It is really fast because it is a commandline program.

vszasz
19th January 2007, 18:54
Why do you use the -padtop and -padbottom which are useful for making correct aspect svcd but little else. You can delete just about every switch you are using except for -target film-dvd and and get a better result. Why drop the vertical resolution to 352 with padding to 480 when FFMPEG will encode a correct aspect DVD at 16:9 at 480 resolution by default?

vszasz
19th January 2007, 18:59
http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html

vszasz
19th January 2007, 19:04
Here's a simple batch file to process multiple files into DVD compatible MPG files at the same quality as the original source. If you find a good GUI, let me know.

@echo off

:: SET SOURCE PATH HERE
@set sourcepath=c:\todo

:: SET DESTINATION PATH HERE
@set destpath=c:\done

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

for %%x in (%sourcepath%\*.avi) do (
ffmpeg -i "%sourcepath%\%%~nx.avi" -sameq -target ntsc-dvd "%destpath%\%%~nx.mpg"
)

maxfu
23rd January 2007, 17:09
Why do you use the -padtop and -padbottom which are useful for making correct aspect svcd but little else. You can delete just about every switch you are using except for -target film-dvd and and get a better result. Why drop the vertical resolution to 352 with padding to 480 when FFMPEG will encode a correct aspect DVD at 16:9 at 480 resolution by default?

The aspect of the source file is about 2.35:1, not 16:9 so I had to pad.

maxfu
23rd January 2007, 17:28
Here's a simple batch file to process multiple files into DVD compatible MPG files at the same quality as the original source. If you find a good GUI, let me know.

@echo off

:: SET SOURCE PATH HERE
@set sourcepath=c:\todo

:: SET DESTINATION PATH HERE
@set destpath=c:\done

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

for %%x in (%sourcepath%\*.avi) do (
ffmpeg -i "%sourcepath%\%%~nx.avi" -sameq -target ntsc-dvd "%destpath%\%%~nx.mpg"
)

I have a GUI, but not in the computer with which I posted this reply. The name is WinFF if I remember correctly. And Videohelp has it. The GUI does not contain any suggented setting to improve quality. But it is a profile-based GUI, you can have your own settings to do the improvement.

maxfu
30th January 2007, 15:58
How to use ffmpeg commandline encoding tool to encode high quality files. Is my commandline good enough?

My commandline:

ffmpeg.exe -i "D:\Video\Fearless\Fearless.avi" -target film-dvd -s 720x352 -padtop 64 -padbottom 64 -maxrate 7350000 -b 3700000 -sc_threshold 1000000000 -trellis -cgop -g 12 -bf 2 -qblur 0.3 -qcomp 0.7 -me full -dc 10 -mbd 2 -aspect 16:9 -pass 1 -passlogfile "D:\Video\ffmpegencode" -an -f mpeg2video "D:\Fearless.m2v"

ffmpeg.exe -i "D:\Video\Fearless\Fearless.avi" -target film-dvd -s 720x352 -padtop 64 -padbottom 64 -maxrate 7350000 -b 3700000 -sc_threshold 1000000000 -trellis -cgop -g 12 -bf 2 -qblur 0.3 -qcomp 0.7 -me full -dc 10 -mbd 2 -aspect 16:9 -pass 2 -passlogfile "D:\Video\ffmpegencode" -an -f mpeg2video "D:\Fearless.m2v"

This setting can encode at a speed of 40fps on my computer.

What do -qblur and -qcomp mean?
And why is the output file still OGOP file?
Is there any GUI for ffmpeg to encode to MPEG2 files?

MPEG2 encoding is really an interesting thing. I used to encode with TMPG, but there is a problem. It is not free. I have to pay for the MPEG2 encoder of TMPG. And it is not fast enough. So several months ago, I tried mencoder. It is fast. But it doesn't obey my maxbitrate setting. The maxbitrate of the output file is too high for my Pioneer standard DVD Player. Then I tried QuEnc. To be honest it is really really good. It is faster than TMPG and it obeys the maxbitrate setting. But it is still not fast enough to encode high quality files with trellis matrix. Finally I found ffmpeg, the core of QuEnc. It is really fast because it is a commandline program.

After testing, -trellis should be removed. The file encoded with this can not be played by my Pioneer Standard DVD Player. And -sc_threshold 1000000000 -cgop should be together to make sure the output file is Closed GOP file.
And, another GUI found. The name is gui4ffmpeg. It is better than WinFF.