Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-04-27 12:55:12 +0400
committerNicolas George <nicolas.george@normalesup.org>2012-05-14 23:29:58 +0400
commit9cf5bcded074cf3294ee1bd4800ec54f1a09a979 (patch)
treed78d2d330dde32cafd139680fb004e36aabd6e07 /ffmpeg.c
parent440af105f2306d3c7b3b3f4d7530bab910d49cb9 (diff)
ffmpeg: accept + prefix to -pix_fmt option to disable automatic conversions.
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 0bd318abc8..fa2c444664 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -319,6 +319,7 @@ typedef struct OutputStream {
int copy_initial_nonkeyframes;
enum PixelFormat pix_fmts[2];
+ int keep_pix_fmt;
} OutputStream;
@@ -706,6 +707,15 @@ static enum PixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum Pixe
static char *choose_pixel_fmts(OutputStream *ost)
{
+ if (ost->keep_pix_fmt) {
+ if (ost->filter)
+ avfilter_graph_set_auto_convert(ost->filter->graph->graph,
+ AVFILTER_AUTO_CONVERT_NONE);
+ if (ost->st->codec->pix_fmt == PIX_FMT_NONE)
+ return NULL;
+ ost->pix_fmts[0] = ost->st->codec->pix_fmt;
+ return ost->pix_fmts;
+ }
if (ost->st->codec->pix_fmt != PIX_FMT_NONE) {
return av_strdup(av_get_pix_fmt_name(choose_pixel_fmt(ost->st, ost->enc, ost->st->codec->pix_fmt)));
} else if (ost->enc->pix_fmts) {
@@ -835,6 +845,10 @@ static int configure_video_filters(FilterGraph *fg)
return ret;
}
+ if (ost->keep_pix_fmt)
+ avfilter_graph_set_auto_convert(fg->graph,
+ AVFILTER_AUTO_CONVERT_NONE);
+
if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
return ret;
@@ -4661,6 +4675,11 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
video_enc->bits_per_raw_sample = frame_bits_per_raw_sample;
MATCH_PER_STREAM_OPT(frame_pix_fmts, str, frame_pix_fmt, oc, st);
+ if (frame_pix_fmt && *frame_pix_fmt == '+') {
+ ost->keep_pix_fmt = 1;
+ if (!*++frame_pix_fmt)
+ frame_pix_fmt = NULL;
+ }
if (frame_pix_fmt && (video_enc->pix_fmt = av_get_pix_fmt(frame_pix_fmt)) == PIX_FMT_NONE) {
av_log(NULL, AV_LOG_FATAL, "Unknown pixel format requested: %s.\n", frame_pix_fmt);
exit_program(1);