mirror of https://github.com/mgba-emu/mgba.git
FFmpeg: Support lossless h.264 encoding
This commit is contained in:
parent
31e0642e64
commit
d6e5bfb640
1
CHANGES
1
CHANGES
|
@ -68,6 +68,7 @@ Misc:
|
||||||
- GB: Fix VRAM/palette locking (fixes mgba.io/i/1109)
|
- GB: Fix VRAM/palette locking (fixes mgba.io/i/1109)
|
||||||
- GB Video: Darken colors in GBA mode
|
- GB Video: Darken colors in GBA mode
|
||||||
- FFmpeg: Support libswresample (fixes mgba.io/i/1120, mgba.io/b/123)
|
- FFmpeg: Support libswresample (fixes mgba.io/i/1120, mgba.io/b/123)
|
||||||
|
- FFmpeg: Support lossless h.264 encoding
|
||||||
|
|
||||||
0.6.3: (2017-04-14)
|
0.6.3: (2017-04-14)
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
|
@ -311,6 +311,15 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
|
||||||
encoder->video->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
encoder->video->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (encoder->video->codec->id == AV_CODEC_ID_H264 &&
|
||||||
|
(strcasecmp(encoder->containerFormat, "mp4") ||
|
||||||
|
strcasecmp(encoder->containerFormat, "m4v") ||
|
||||||
|
strcasecmp(encoder->containerFormat, "mov"))) {
|
||||||
|
// QuickTime and a few other things require YUV420
|
||||||
|
encoder->video->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(vcodec->name, "libx264") == 0) {
|
if (strcmp(vcodec->name, "libx264") == 0) {
|
||||||
// Try to adaptively figure out when you can use a slower encoder
|
// Try to adaptively figure out when you can use a slower encoder
|
||||||
if (encoder->width * encoder->height > 1000000) {
|
if (encoder->width * encoder->height > 1000000) {
|
||||||
|
@ -320,16 +329,12 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
|
||||||
} else {
|
} else {
|
||||||
av_opt_set(encoder->video->priv_data, "preset", "faster", 0);
|
av_opt_set(encoder->video->priv_data, "preset", "faster", 0);
|
||||||
}
|
}
|
||||||
av_opt_set(encoder->video->priv_data, "tune", "zerolatency", 0);
|
if (encoder->videoBitrate == 0) {
|
||||||
|
av_opt_set(encoder->video->priv_data, "crf", "0", 0);
|
||||||
|
encoder->video->pix_fmt = AV_PIX_FMT_YUV444P;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encoder->video->codec->id == AV_CODEC_ID_H264 &&
|
|
||||||
(strcasecmp(encoder->containerFormat, "mp4") ||
|
|
||||||
strcasecmp(encoder->containerFormat, "m4v") ||
|
|
||||||
strcasecmp(encoder->containerFormat, "mov"))) {
|
|
||||||
// QuickTime and a few other things require YUV420
|
|
||||||
encoder->video->pix_fmt = AV_PIX_FMT_YUV420P;
|
|
||||||
}
|
|
||||||
avcodec_open2(encoder->video, vcodec, 0);
|
avcodec_open2(encoder->video, vcodec, 0);
|
||||||
#if LIBAVCODEC_VERSION_MAJOR >= 55
|
#if LIBAVCODEC_VERSION_MAJOR >= 55
|
||||||
encoder->videoFrame = av_frame_alloc();
|
encoder->videoFrame = av_frame_alloc();
|
||||||
|
|
|
@ -99,7 +99,7 @@ VideoView::VideoView(QWidget* parent)
|
||||||
|
|
||||||
setPreset({
|
setPreset({
|
||||||
.container = "MKV",
|
.container = "MKV",
|
||||||
.vcodec = "PNG",
|
.vcodec = "h.264",
|
||||||
.acodec = "FLAC",
|
.acodec = "FLAC",
|
||||||
.vbr = 0,
|
.vbr = 0,
|
||||||
.abr = 0,
|
.abr = 0,
|
||||||
|
@ -179,7 +179,7 @@ void VideoView::updatePresets() {
|
||||||
if (m_nativeWidth && m_nativeHeight) {
|
if (m_nativeWidth && m_nativeHeight) {
|
||||||
addPreset(m_ui.presetLossless, {
|
addPreset(m_ui.presetLossless, {
|
||||||
.container = "MKV",
|
.container = "MKV",
|
||||||
.vcodec = "PNG",
|
.vcodec = "h.264",
|
||||||
.acodec = "FLAC",
|
.acodec = "FLAC",
|
||||||
.vbr = 0,
|
.vbr = 0,
|
||||||
.abr = 0,
|
.abr = 0,
|
||||||
|
|
|
@ -254,11 +254,6 @@
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>PNG</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>h.264</string>
|
<string>h.264</string>
|
||||||
|
@ -353,9 +348,6 @@
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
|
||||||
<number>200</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>10000</number>
|
<number>10000</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -523,7 +515,7 @@
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
<buttongroup name="presets"/>
|
|
||||||
<buttongroup name="resolutions"/>
|
<buttongroup name="resolutions"/>
|
||||||
|
<buttongroup name="presets"/>
|
||||||
</buttongroups>
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Reference in New Issue