| Video | Audio | RGB | YUV | YUV422 | multiple instances | processing type |
| yes | no | yes | yes | no | no | PRE |
There are two modes of operation, buffered and unbuffered, unbuffered is quick, but buffered, especially when dropping frames should look better.
For most users, modfps will need either no options, or just mode=1.
Default values are shown in [green] in square brackets.
As of transcode 0.6.9 filters do not see frames which are not in the range of -c ... thus if one is cutting frames 1000-1500 the first frame modfps sees is 1000. As modfps buffers the frame it sets the TC_FRAME_IS_SKIPPED flag, so it won't be encoded. After it's read in the buffers it wants, it will start outputting the frames it's buffered. I.e. the first frame modfps doesn't set as skipped will be 1005 from the encoder's point of view while corresponding to frame 1000 from the import stream.
When using -c, one should add the number of buffers to the last segment, because all of the frames are offset by a bit.
I.e. if: -c 3916-13090,17493-24185,28304-42212,46777-54710 gives you the segments you want without modifying the frame rates, when you use modfps=buffers=5 (the default) you should modify the option to -c 3916-13090,17493-24185,28304-42212,46777-54715
Also of interest is that ivtc works as well with modfps as it does with decimate. While there's no real benefit to use it when transcoding from 29.97 to 23.976 fps I've seen 29.97 video which has telecine effects, except it's at 25.0 fps ... -J ivtc,modfps=buffers=7 works well in this case.
When using -J cut, cut will alter the number of audio frames skipped so that -J cut=1000-1500,modfps -f 29.97 --export_fps 23,1 will keep the AV in sync while -c wouldn't. However, again all the frames in the export are off by the number of buffers. But the effects are different from -c, so if you wanted to use -J cut="3916-13090,17493-24185,28304-42212 you would then use -J cut="3921-13095,17498-24190,28309-42217
First, I do a first pass of xvid, video only.
/usr/bin/nice -n +19 /usr/local/test/bin/transcode --print_status 5 \
--export_fps 25.0,3 -x mplayer -J modfps=buffer=7,hqdn3d -V -i tv.avi \
-b 64 -c 3916-13090,17493-24185,28304-42212,46777-54715 -y xvid,null \
-j 0,8 -Y 0,-4 -B 0,39,08 -w 600 -R 1
Next, I do the 2nd pass, again, video only.
/usr/bin/nice -n +19 /usr/local/test/bin/transcode --print_status 5 \
--export_fps 25.0,3 -x mplayer -J modfps=buffer=7,hqdn3d -V -i tv.avi \
-b 64 -c 3916-13090,17493-24185,28304-42212,46777-54715 -y xvid,null \
-j 0,8 -Y 0,-4 -B 0,39,08 -w 600 -R 2 -o tmp.tv.avi
Now that I have the video, I examine audio. I've found that since commercials are much louder than TV, before I give anything to filter astat, I'll rip the raw audio. Note, that the values of -c are different for audio than they were for video.
I wish to stress: Currently, one cannot use -c with transcode and process audio and video at the same time while changing the frame rate without losing AV sync.
/usr/bin/nice -n +19 /usr/local/test/bin/transcode --print_status 500 \
-f 29.970 --export_fps 25.000 -u 35 -x null,auto -y null,wav \
-m sound.tv.avi -c 3267-10919,14593-20175,23611-35212,39020-45637 -i tv.avi
Then we do a quick pass thru with filter astat.
/usr/bin/nice -n +19 /usr/local/test/bin/transcode --print_status 500 \
-f 23.976,1 -p sound.tv.avi -J astat=alog -u 50
Finally, I encode the audio while using passthru mode to merge it with video.
/usr/bin/nice -n +19 /usr/local/test/bin/transcode --print_status 50 \
-i tmp.tv.avi -o out.tv.avi -p sound.tv.avi -s `cat alog` -P1 -b 64 \
-y raw
Please note in the above example that modfps was only used to handle changing the rate of the video, and that one must give different values to -c (as of transcode 0.6.9)
#!/usr/bin/perl
$numbuffers = 5;
$i = 0;
$argc = @ARGV;
# we take one argument: the number of buffers
if ($argv > 0){
$numbuffers = $ARGV[0];
}
while(<STDIN>){
if(/^Start : (\d+)/){
# even tho initially some frames will be skipped, with newest
# transcode, we keep the beginning where it should be, but we must
# add 5 frames to the very last segment.
$c[$i]{start} = 1 + $1;
$_ = <STDIN>;
if(/^Size : (\d+)/){
$c[$i]{end} = $c[$i]{start}+$1;
$i++;
} else {
print;
die "ergh, we were supposed to find the end\n";
}
}
}
if($i > 0){
$c[$i-1]{end} += $numbuffers ;
} else {
print "-c 0";
exit -1;
}
print "-c ";
for($j=0;$j<$i;$j++){
print "$c[$j]{start}-$c[$j]{end}";
if($i-1 != $j){
print ",";
}
}
print "\n";
#!/usr/bin/perl
# read from stdin the workbench
$infps = 5;
$outfps = 4;
$argc=@ARGV;
if ($argc>0){
$infps=$ARGV[0];
}
if ($argc>1){
$outfps = $ARGV[1];
}
use POSIX;
$i = 0;
while(<STDIN>){
if(/^Start : (\d+)/){
$c[$i]{start} = ceil((1+$1)*($outfps/$infps));
$_ = <STDIN>;
if(/^Size : (\d+)/){
$c[$i]{end} = floor($c[$i]{start}+($1*$outfps/$infps));
$i++;
} else {
print;
die "ergh, we were supposed to find the end\n";
}
}
}
print "-c ";
for($j=0;$j<$i;$j++){
print "$c[$j]{start}-$c[$j]{end}";
if($i-1 != $j){
print ",";
}
}
print "\n";
The first script takes one argument, the number of buffers passed to modfps, and will default to 5, like modfps. The 2nd script takes two arguments, the import_fps and the export_fps. Note that the intent of my choice of audio sections was not to get audio outside of the cutzone (possibly large noise from the very last bit of a commercial), and thus the video and audio might end up encoding a different number of frames, and thus with many cut sections, AV sync might be lost. However, these work for me ;)