Skip to content

Commit 453c4d8

Browse files
committed
ffmpeg: Set default output format to hwaccel's native format
I think this is usually what the user wants - if they are using an hwaccel, they probably want full hardware transcoding to work.
1 parent 1edbf5e commit 453c4d8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ffmpeg_opt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
708708
char *discard_str = NULL;
709709
const AVClass *cc = avcodec_get_class();
710710
const AVOption *discard_opt = av_opt_find(&cc, "skip_frame", NULL, 0, 0);
711+
enum AVPixelFormat default_pix_fmt = AV_PIX_FMT_NONE;
711712

712713
if (!ist)
713714
exit_program(1);
@@ -805,6 +806,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
805806
for (i = 0; hwaccels[i].name; i++) {
806807
if (!strcmp(hwaccels[i].name, hwaccel)) {
807808
ist->hwaccel_id = hwaccels[i].id;
809+
default_pix_fmt = hwaccels[i].pix_fmt;
808810
break;
809811
}
810812
}
@@ -837,7 +839,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
837839
"format: %s", hwaccel_output_format);
838840
}
839841
} else {
840-
ist->hwaccel_output_format = AV_PIX_FMT_NONE;
842+
ist->hwaccel_output_format = default_pix_fmt;
841843
}
842844

843845
ist->hwaccel_pix_fmt = AV_PIX_FMT_NONE;

0 commit comments

Comments
 (0)