Hi I use FFMPEG from http://ffdshow.faireal.net/mirror/ffmpeg/ to transcode from any format (sometimes HDTV 1080i) to PAL-DVD. Sometimes an input clip is very "blocky".
Is there an FFMPEG commandline switch or technique which forces the input clip to be strongly deblocked before or during transcoding ?
I'm currently using these batch files (be aware of line wrapping by the forum quote mechanism...)
1. for interlaced material
2. for progressive material
@echo OFF
REM put fully-qualified drive/path/filename in between the quotes
Call :1pass ""
pause
exit
:1pass
REM 1-pass 1080i to 576i
set fINPUT=%~1%
set fOUTPUT=%~1%.mpg
set f2passlogfile=%~1%.log
set fSIZE=704x576
set fASPECT=16:9
set faveragebitrate=9200k
set fMAXBITRATE=9400k
set fMINBITRATE=1000k
set faudiofreq=48000
set faudiobitrate=192k
Rem Tff=1 Bff=0
set FieldFirst=1
REM http://ffmpeg.mplayerhq.hu/faq.html#SEC26
REM -mbd rd -flags +trell -cmp 2 -subcmp 2 -g 100
"C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i "%fINPUT%" -target pal-dvd -b %faveragebitrate% -minrate %fMINBITRATE% -maxrate %fMAXBITRATE% -qmin 1 -qmax 31 -ilme -ildct -flags +ildct+ilme+trell -top %FieldFirst% -dc 10 -mbd rd -cmp 2 -subcmp 2 -s %fSIZE% -aspect %fASPECT% -ab %faudiobitrate% -ar %faudiofreq% -ac 2 -acodec ac3 "%fOUTPUT%"
goto :EOF
:2pass
REM 2-pass 1080i to 576i
set fINPUT=%~1%
set fOUTPUT=%~1%.mpg
set f2passlogfile=%~1%.log
set fSIZE=704x576
set fASPECT=16:9
set faveragebitrate=9200k
set fMAXBITRATE=9400k
set fMINBITRATE=1000k
set faudiofreq=48000
set faudiobitrate=192k
Rem Tff=1 Bff=0
set FieldFirst=1
REM http://ffmpeg.mplayerhq.hu/faq.html#SEC26
REM -mbd rd -flags +trell -cmp 2 -subcmp 2 -g 100
"C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i "%fINPUT%" -pass 1 -passlogfile "%f2passlogfile%" -target pal-dvd -b %faveragebitrate% -minrate %fMINBITRATE% -maxrate %fMAXBITRATE% -qmin 1 -qmax 31 -ilme -ildct -flags +ildct+ilme+trell -top %FieldFirst% -dc 10 -mbd rd -cmp 2 -subcmp 2 -s %fSIZE% -aspect %fASPECT% -an "%fOUTPUT%"
"C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i "%fINPUT%" -pass 2 -passlogfile "%f2passlogfile%" -target pal-dvd -b %faveragebitrate% -minrate %fMINBITRATE% -maxrate %fMAXBITRATE% -qmin 1 -qmax 31 -ilme -ildct -flags +ildct+ilme+trell -top %FieldFirst% -dc 10 -mbd rd -cmp 2 -subcmp 2 -s %fSIZE% -aspect %fASPECT% -ab %faudiobitrate% -ar %faudiofreq% -ac 2 -acodec ac3 "%fOUTPUT%"
goto :EOF
@echo OFF
REM put fully-qualified drive/path/filename in between the quotes
Call :1pass ""
pause
exit
:1pass
REM 1-pass 1080i to 576i
set fINPUT=%~1%
set fOUTPUT=%~1%.mpg
set f2passlogfile=%~1%.log
set fSIZE=704x576
set fASPECT=16:9
set faveragebitrate=9200k
set fMAXBITRATE=9400k
set fMINBITRATE=1000k
set faudiofreq=48000
set faudiobitrate=192k
Rem Tff=1 Bff=0
set FieldFirst=1
REM http://ffmpeg.mplayerhq.hu/faq.html#SEC26
REM -mbd rd -flags +trell -cmp 2 -subcmp 2 -g 100
"C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i "%fINPUT%" -target pal-dvd -b %faveragebitrate% -minrate %fMINBITRATE% -maxrate %fMAXBITRATE% -qmin 1 -qmax 31 -dc 10 -mbd rd -flags +trell -cmp 2 -subcmp 2 -s %fSIZE% -aspect %fASPECT% -ab %faudiobitrate% -ar %faudiofreq% -ac 2 -acodec ac3 "%fOUTPUT%"
goto :EOF
:2pass
REM 2-pass 1080i to 576i
set fINPUT=%~1%
set fOUTPUT=%~1%.mpg
set f2passlogfile=%~1%.log
set fSIZE=704x576
set fASPECT=16:9
set faveragebitrate=9200k
set fMAXBITRATE=9400k
set fMINBITRATE=1000k
set faudiofreq=48000
set faudiobitrate=192k
Rem Tff=1 Bff=0
set FieldFirst=1
REM http://ffmpeg.mplayerhq.hu/faq.html#SEC26
REM -mbd rd -flags +trell -cmp 2 -subcmp 2 -g 100
"C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i "%fINPUT%" -pass 1 -passlogfile "%f2passlogfile%" -target pal-dvd -b %faveragebitrate% -minrate %fMINBITRATE% -maxrate %fMAXBITRATE% -qmin 1 -qmax 31 -dc 10 -mbd rd -flags +trell -cmp 2 -subcmp 2 -s %fSIZE% -aspect %fASPECT% -an "%fOUTPUT%"
"C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i "%fINPUT%" -pass 2 -passlogfile "%f2passlogfile%" -target pal-dvd -b %faveragebitrate% -minrate %fMINBITRATE% -maxrate %fMAXBITRATE% -qmin 1 -qmax 31 -dc 10 -mbd rd -flags +trell -cmp 2 -subcmp 2 -s %fSIZE% -aspect %fASPECT% -ab %faudiobitrate% -ar %faudiofreq% -ac 2 -acodec ac3 "%fOUTPUT%"
goto :EOF
+ Reply to Thread
Results 1 to 8 of 8
-
-
Thankyou, yes avisynth with say deblock_qed_mt2 is always an option. I wasn't entirely comfortable with speed of avisynth into the fantastic (and free) HC encoder though, per link http://forum.doom9.org/showthread.php?p=1119175#post1119175
I could try deblock_qed_mt2 with no resizing and whatnot and feed that into ffmpeg... however interlaced input would still be a problem (ie delinterlace to deblock inside the avsynth script, however without the resizing code... let ffmpeg do it) and would probably end up with the same speeds as shown (PAL HDTV 1080i25 -> 576i25) from that link, viz
So for a 2.75 hour sports game, approx encoding times
yadifmod+nnedi+HC version = about 17 hours or 0.7 days
tdeint+HC version = about 17 hours or 0.7 days
ffmpeg version = about 4.6 hours or 0.2 days -
Just tested PAL 1080i25 -> PAL 576i25 with avisynth input to ffmpeg, just doing a tdeint and reinterlace (no deblock_qed_mt2) and it runs at about 3 frames per sec 1st pass and the same 2nd pass, for an aggregated speed of about 1.5 frames per second ... and that's without the deblock_qed_mt2 on the full-size frame !
If ffmpeg can do additional "deblocking" "internally" then I'd really really really like to hear about it ... -
halsboss, if its speed that is the main consirn here then how about post-pros'ing it to
a raw avi video or at least to a codec format. I mean, in theory it should work, though I do
recall reading somewhere how a person researched this and concluded that it does work. Only,
I don't remember what was the final verdict, the codec used
I'm in the habbit of doing this (sometimes, for this reason) but mostly for when I need to process
Lagarith codec material into ffmpeg for encoding. ffmpeg doesn't accept it, and if I create an
avisynth script to psuedo it into ffmpeg (I developed a suite tool for command-line apps) it does
slow the processing down some. To me, I rather wait for a *new* avi created file. Plus, there
are advantages to doing this. But, you be the judge on what functions you require to get a job
done
If you have the HDD space, (and today, that is no longer a problem) you might want to consider
that as an option. Well, I guess that depends on your project goals and things.
-vhelp 4601 -
Thanks vhelp,
the goal is to deblock a range of incoming source clips of various resolutions etc - sometimes SDTV or HDTV can be very blocky (!) - into DVD-compatible video/audio, in reasonable time periods (better than 1-2 fps).
I have about 500Gig free, so I'll test your good suggestion then ... if I understood it,
1. avisynth to
1.1 deinterlace
1.2. leave out deblock_qed_mt2 just to see the raw speed and how it goes
1.3. then reinterlace
2. then use (?) Vdub (?) with the avisynth script as input to save the output into say a huffy? .avi file (does huffy handle TFF interlaced ? It must I guess.) ... demux and process/save the audio separately ?
3. run 2-pass ffmpeg over the temporary .avi to produce the DVD compatible results
Don't know anything about raw format ... any pointers ?
Just wondering, what does "(I developed a suite tool for command-line apps) " mean ... something joe public can peruse maybe?
-
Just wondering, what does "(I developed a suite tool for command-line apps) " mean ... something joe public can peruse maybe ?
useful command line app (ie, ffmpeg; mencoder; mp4boxand many many others) I consider
weaving it into the tool -- a front end, if you will, hence, my suite-tool, I guessBut its
a work in progress. Always making changes and enhances and things.
--- raw format avi's
The only codec I know of that allows you to capture in the RAW (ie, 422 and 420) is the one provided
by ATI's older capture cards, like my ATI Rage Fury Pro, and my ATI TV Wonder cards.
But these codecs are usually in the YUV color space (ie, YUY2 and YV12 and Y41p) are some.
The raw codec (encoders) are the ones listed as 411 and yv12, but you might see some for 420 etc.
These do not use any compression schemes, but rather that they use the "sampling" format of the
yuv color space, as noted above. Some are Planar and some are Packed structure.
When you capture in the RAW format, you get the maximum (detail) quality of the image, but you
will need a lot more HDD space for these. That's why people use Huffy or Lagarith. I myself was
using Lagarith until I found XviD can capture in non-compressed form (or nearly) and that thanks
to my latest computer upgrade (with XP) that it can handle this codec with ease AND with
less HDD space requirements. I think it compresses even smaller than DVThe only diff is
the color space format, DV's 411 vs. XviD's 420, though I would prefer the XviD because with
DV the source has to be upsampled to 422 sampling and that is usually done by the codec w/out
your ability to change that, unless you use the cedocida codec, by A. Dittrich, where you have
the opportunity to change this, I think.
Anyway. All this raw stuff is not that important unless you really need absolute detail, usually
for video/image analysis work. I sometimes require this when I'm working/studying different aspects
of a video, etc.
--- regarding "deblocking"
I don't know.. but have you seen this discussion. There's a problem pic that was posted there, but
when I downloaded the (vob) clip and played it, it did not look the same as the pic. I mean, the pic
is much cleaner, de-blocked, that is. At least that is what it looks like to me. And I thought that
(if that be true) its a nice deblocking routine to use. But I don't know if that was applied to the pic
in that topic, below. But I wouldn't mind knowing what he used.
--> Big blocks on XVid to MPEG conversion -- by hewsongs; March 29, 2008
EDIT: 03.31.08.Mon.8:58pm
Erraaah, looks lik I was in error. At first glance the pic looked to be deblocked, but wasn't. And,
it wasn'ta vob file I D/L'ed, it was an xvidSorry for the confusion.
-vhelp 4618 -
Similar Threads
-
dv cassette deblocking
By noiz in forum RestorationReplies: 7Last Post: 16th May 2011, 18:13 -
Blu-Ray player as strong as WDTV in MKV support on DVD
By mesowetodit in forum DVD & Blu-ray PlayersReplies: 8Last Post: 23rd Sep 2010, 02:03 -
AVI (DV Pal) to mp4 (h264) with FFMPEG on Windows
By Zoreil59 in forum Video ConversionReplies: 3Last Post: 17th Jun 2010, 03:35 -
ffmpeg won't convert files from Pal to NTSC, mpegstreamclip does
By ruggerjvd in forum ffmpegX general discussionReplies: 2Last Post: 8th Jun 2009, 08:39 -
deblocking a video
By themaster1 in forum Video ConversionReplies: 3Last Post: 26th Feb 2008, 10:44