mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
x264enc: Fix for 0/1 framerate - now uses VFR in this case
Previously did a division by zero. https://bugzilla.gnome.org/show_bug.cgi?id=695728
This commit is contained in:
parent
53d7e8436c
commit
2e38f24b56
1 changed files with 16 additions and 6 deletions
|
@ -312,7 +312,7 @@ static const GFlagsValue tune_types[] = {
|
||||||
{0x0, "No tuning", "none"},
|
{0x0, "No tuning", "none"},
|
||||||
{0x1, "Still image", "stillimage"},
|
{0x1, "Still image", "stillimage"},
|
||||||
{0x2, "Fast decode", "fastdecode"},
|
{0x2, "Fast decode", "fastdecode"},
|
||||||
{0x4, "Zero latency (requires constant framerate)", "zerolatency"},
|
{0x4, "Zero latency", "zerolatency"},
|
||||||
{0, NULL, NULL},
|
{0, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1217,8 +1217,21 @@ gst_x264_enc_init_encoder (GstX264Enc * encoder)
|
||||||
/* set up encoder parameters */
|
/* set up encoder parameters */
|
||||||
encoder->x264param.i_csp =
|
encoder->x264param.i_csp =
|
||||||
gst_x264_enc_gst_to_x264_video_format (info->finfo->format, NULL);
|
gst_x264_enc_gst_to_x264_video_format (info->finfo->format, NULL);
|
||||||
encoder->x264param.i_fps_num = info->fps_n;
|
if (info->fps_d == 0 || info->fps_n == 0) {
|
||||||
encoder->x264param.i_fps_den = info->fps_d;
|
/* No FPS so must use VFR
|
||||||
|
* This raises latency apparently see http://mewiki.project357.com/wiki/X264_Encoding_Suggestions */
|
||||||
|
encoder->x264param.b_vfr_input = TRUE;
|
||||||
|
if (encoder->keyint_max) { /* NB the default is 250 setup by x264 itself */
|
||||||
|
encoder->x264param.i_keyint_max = encoder->keyint_max;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* FPS available so set it up */
|
||||||
|
encoder->x264param.i_fps_num = info->fps_n;
|
||||||
|
encoder->x264param.i_fps_den = info->fps_d;
|
||||||
|
encoder->x264param.i_keyint_max =
|
||||||
|
encoder->keyint_max ? encoder->keyint_max : (10 * info->fps_n /
|
||||||
|
info->fps_d);
|
||||||
|
}
|
||||||
encoder->x264param.i_width = info->width;
|
encoder->x264param.i_width = info->width;
|
||||||
encoder->x264param.i_height = info->height;
|
encoder->x264param.i_height = info->height;
|
||||||
if (info->par_d > 0) {
|
if (info->par_d > 0) {
|
||||||
|
@ -1226,9 +1239,6 @@ gst_x264_enc_init_encoder (GstX264Enc * encoder)
|
||||||
encoder->x264param.vui.i_sar_height = info->par_d;
|
encoder->x264param.vui.i_sar_height = info->par_d;
|
||||||
}
|
}
|
||||||
|
|
||||||
encoder->x264param.i_keyint_max = encoder->keyint_max ? encoder->keyint_max :
|
|
||||||
(10 * info->fps_n / info->fps_d);
|
|
||||||
|
|
||||||
if ((((info->height == 576) && ((info->width == 720)
|
if ((((info->height == 576) && ((info->width == 720)
|
||||||
|| (info->width == 704) || (info->width == 352)))
|
|| (info->width == 704) || (info->width == 352)))
|
||||||
|| ((info->height == 288) && (info->width == 352)))
|
|| ((info->height == 288) && (info->width == 352)))
|
||||||
|
|
Loading…
Reference in a new issue