H264编码器设置

时间:2011-11-30 20:39:46

标签: encoding ffmpeg h.264 xuggle mpeg-4

我正在使用xuggler将一系列图像编码为MP4文件。我使用以下代码设置IStreamCoder并指定H264编解码器:

// only set if codec is H264
Configuration.configure("/usr/local/xuggler/share/ffmpeg/libx264-hq.ffpreset",
            outStreamCoder);

outStreamCoder.setNumPicturesInGroupOfPictures(12);
outStreamCoder.setCodec(codec);
outStreamCoder.setBitRate(videoSettings.getBitrate());
outStreamCoder.setBitRateTolerance(videoSettings.getBitrateTolerance());
outStreamCoder.setPixelType(IPixelFormat.Type.YUV420P);
outStreamCoder.setHeight(videoSettings.getResolution().height);
outStreamCoder.setWidth(videoSettings.getResolution().width);
outStreamCoder.setFlag(IStreamCoder.Flags.FLAG_QSCALE, true);
outStreamCoder.setGlobalQuality(0);
fps = IRational.make((int) videoSettings.getFramerate(), 1);
outStreamCoder.setFrameRate(fps);
outStreamCoder.setTimeBase(IRational.make(fps.getDenominator(), fps.getNumerator()));

产生以下输出:

Codec: CODEC_ID_H264
Resolution: 1280x720
Bitrate: 25000
Bitrate Tolerance: 1000
Framerate: 25.0

H264 encoded video

现在,当我指定MPEG4编解码器时,我得到以下输出:

Codec: CODEC_ID_MPEG4
Resolution: 1280x720
Bitrate: 25000
Bitrate Tolerance: 1000
Framerate: 25.0

MPEG4 encoded video

如您所见,唯一的区别是ICodec类型(MPEG4而不是H264)和预设的使用(使用H264编解码器时xuggler需要)。任何人都可以向我解释质量的巨大差异并告诉我如何解决这个问题吗?

0 个答案:

没有答案