1

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 でエンコードされたビデオ

MPEG4 コーデックを指定すると、次の出力が得られます。

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

MPEG4 でエンコードされたビデオ

ご覧のとおり、唯一の違いはICodecタイプ (H264 ではなく MPEG4) とプリセットの使用 (H264 コーデックを使用する場合に xuggler で必要とされる) です。品質の大きな違いを説明し、問題を解決する方法を教えてくれる人はいますか?

4

0 に答える 0