fix FlvFilterTest and swith movie codec from flv to h.264

This commit is contained in:
Erik Forkalsrud 2011-07-31 21:43:15 -07:00
parent e039870adc
commit 46094b5c1e
2 changed files with 7 additions and 7 deletions

View file

@ -163,6 +163,8 @@ public class MovieCoder {
public EncodingProcess(File file, Thumbnail thumbnail, Dimension size) {
this.file = file;
this.targetSize = size;
if (targetSize.getWidth() % 2 > 0) targetSize = new Dimension(targetSize.getWidth() + 1, targetSize.getHeight());
if (targetSize.getHeight() % 2 > 0) targetSize = new Dimension(targetSize.getWidth(), targetSize.getHeight() + 1);
this.dbKey = key(file, targetSize);
FlvMetadata extraMeta = new FlvMetadata();
extraMeta.setDuration(thumbnail.getDuration());
@ -178,7 +180,7 @@ public class MovieCoder {
* and we want an output bitrate about 1 Mbit/sec
* we can do a one pass encoding like this:
*
* ffmpeg -i <infile> -aspect 1280:720 -s 640x360 -b 1000000 -crf 25 \
* ffmpeg -i <infile> -aspect 1280:720 -s 640x360 -b 1000000 -crf 20 \
* -vcodec libx264 -vpre knut_low \
* -acodec libfaac -aq 100 \
* <outfile>.mp4
@ -203,12 +205,10 @@ public class MovieCoder {
ffmpegExecutable, "-i", file.getAbsolutePath(),
// "-aspect", (thumbnail.getSize().getWidth() + ":" + thumbnail.getSize().getHeight()),
"-s", (targetSize.getWidth() + "x" + targetSize.getHeight()),
"-b", "150k",
"-acodec", "libmp3lame", "-ar", "22050", "-vcodec", "flv",
"-g", "150", "-cmp", "2", "-subcmp", "2", "-mbd", "2",
"-flags", "+aic+cbp+mv0+mv4", "-trellis", "1",
"-crf", "30",
"-acodec", "libmp3lame", "-ar", "22050", "-vcodec", "libx264",
"-g", "150", "-vpre", "medium",
"-f", "flv",
// "-metadata", "duration=" + thumbnail.getDuration(),
"-");
log.info(pb.command().toString());

View file

@ -30,7 +30,7 @@ public class FlvFilterTest extends TestCase {
FlvFilter os = new FlvFilter(receiver, new FlvMetadata());
IOUtils.copy(is, os);
os.generateHeaderChunk();
assertEquals("HEADER[320]BODY[0]HEADER[797]BODY[911684]", buf.toString());
assertEquals("HEADER[320]BODY[0]HEADER[800]BODY[911684]", buf.toString());
}
public void testFoo() {