fix FlvFilterTest and swith movie codec from flv to h.264
This commit is contained in:
parent
e039870adc
commit
46094b5c1e
2 changed files with 7 additions and 7 deletions
|
|
@ -163,6 +163,8 @@ public class MovieCoder {
|
||||||
public EncodingProcess(File file, Thumbnail thumbnail, Dimension size) {
|
public EncodingProcess(File file, Thumbnail thumbnail, Dimension size) {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.targetSize = size;
|
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);
|
this.dbKey = key(file, targetSize);
|
||||||
FlvMetadata extraMeta = new FlvMetadata();
|
FlvMetadata extraMeta = new FlvMetadata();
|
||||||
extraMeta.setDuration(thumbnail.getDuration());
|
extraMeta.setDuration(thumbnail.getDuration());
|
||||||
|
|
@ -178,7 +180,7 @@ public class MovieCoder {
|
||||||
* and we want an output bitrate about 1 Mbit/sec
|
* and we want an output bitrate about 1 Mbit/sec
|
||||||
* we can do a one pass encoding like this:
|
* 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 \
|
* -vcodec libx264 -vpre knut_low \
|
||||||
* -acodec libfaac -aq 100 \
|
* -acodec libfaac -aq 100 \
|
||||||
* <outfile>.mp4
|
* <outfile>.mp4
|
||||||
|
|
@ -203,12 +205,10 @@ public class MovieCoder {
|
||||||
ffmpegExecutable, "-i", file.getAbsolutePath(),
|
ffmpegExecutable, "-i", file.getAbsolutePath(),
|
||||||
// "-aspect", (thumbnail.getSize().getWidth() + ":" + thumbnail.getSize().getHeight()),
|
// "-aspect", (thumbnail.getSize().getWidth() + ":" + thumbnail.getSize().getHeight()),
|
||||||
"-s", (targetSize.getWidth() + "x" + targetSize.getHeight()),
|
"-s", (targetSize.getWidth() + "x" + targetSize.getHeight()),
|
||||||
"-b", "150k",
|
"-crf", "30",
|
||||||
"-acodec", "libmp3lame", "-ar", "22050", "-vcodec", "flv",
|
"-acodec", "libmp3lame", "-ar", "22050", "-vcodec", "libx264",
|
||||||
"-g", "150", "-cmp", "2", "-subcmp", "2", "-mbd", "2",
|
"-g", "150", "-vpre", "medium",
|
||||||
"-flags", "+aic+cbp+mv0+mv4", "-trellis", "1",
|
|
||||||
"-f", "flv",
|
"-f", "flv",
|
||||||
// "-metadata", "duration=" + thumbnail.getDuration(),
|
|
||||||
"-");
|
"-");
|
||||||
|
|
||||||
log.info(pb.command().toString());
|
log.info(pb.command().toString());
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class FlvFilterTest extends TestCase {
|
||||||
FlvFilter os = new FlvFilter(receiver, new FlvMetadata());
|
FlvFilter os = new FlvFilter(receiver, new FlvMetadata());
|
||||||
IOUtils.copy(is, os);
|
IOUtils.copy(is, os);
|
||||||
os.generateHeaderChunk();
|
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() {
|
public void testFoo() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue