1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

fftools/ffmpeg: remove options deprecated before 6.0

This commit is contained in:
Anton Khirnov 2024-02-21 10:18:39 +01:00
parent f7545e90df
commit e48055fdce
8 changed files with 3 additions and 345 deletions

View File

@ -28,6 +28,7 @@ version <next>:
will be bumped to C17 in the near future, so consider updating your
build environment if it lacks C17 support
- Change the default bitrate control method from VBR to CQP for QSV encoders.
- removed deprecated ffmpeg CLI options -psnr and -map_channel
version 6.1:
- libaribcaption decoder

View File

@ -1230,10 +1230,6 @@ list separated with slashes. Two first values are the beginning and
end frame numbers, last one is quantizer to use if positive, or quality
factor if negative.
@item -psnr
Calculate PSNR of compressed frames. This option is deprecated, pass the
PSNR flag to the encoder instead, using @code{-flags +psnr}.
@item -vstats
Dump video coding statistics to @file{vstats_HHMMSS.log}. See the
@ref{vstats_file_format,,vstats file format} section for the format description.
@ -1806,77 +1802,6 @@ such streams is attempted.
Allow input streams with unknown type to be copied instead of failing if copying
such streams is attempted.
@item -map_channel [@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][?][:@var{output_file_id}.@var{stream_specifier}]
This option is deprecated and will be removed. It can be replaced by the
@var{pan} filter. In some cases it may be easier to use some combination of the
@var{channelsplit}, @var{channelmap}, or @var{amerge} filters.
Map an audio channel from a given input to an output. If
@var{output_file_id}.@var{stream_specifier} is not set, the audio channel will
be mapped on all the audio streams.
Using "-1" instead of
@var{input_file_id}.@var{stream_specifier}.@var{channel_id} will map a muted
channel.
A trailing @code{?} will allow the map_channel to be
optional: if the map_channel matches no channel the map_channel will be ignored instead
of failing.
For example, assuming @var{INPUT} is a stereo audio file, you can switch the
two audio channels with the following command:
@example
ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT
@end example
If you want to mute the first channel and keep the second:
@example
ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT
@end example
The order of the "-map_channel" option specifies the order of the channels in
the output stream. The output channel layout is guessed from the number of
channels mapped (mono if one "-map_channel", stereo if two, etc.). Using "-ac"
in combination of "-map_channel" makes the channel gain levels to be updated if
input and output channel layouts don't match (for instance two "-map_channel"
options and "-ac 6").
You can also extract each channel of an input to specific outputs; the following
command extracts two channels of the @var{INPUT} audio stream (file 0, stream 0)
to the respective @var{OUTPUT_CH0} and @var{OUTPUT_CH1} outputs:
@example
ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1
@end example
The following example splits the channels of a stereo input into two separate
streams, which are put into the same output file:
@example
ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 0.0.1:0.1 -y out.ogg
@end example
Note that currently each output stream can only contain channels from a single
input stream; you can't for example use "-map_channel" to pick multiple input
audio channels contained in different streams (from the same or different files)
and merge them into a single output stream. It is therefore not currently
possible, for example, to turn two separate mono streams into a single stereo
stream. However splitting a stereo stream into two single channel mono streams
is possible.
If you need this feature, a possible workaround is to use the @emph{amerge}
filter. For example, if you need to merge a media (here @file{input.mkv}) with 2
mono audio streams into one single stereo channel audio stream (and keep the
video stream), you can use the following command:
@example
ffmpeg -i input.mkv -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le -c:v copy output.mkv
@end example
To map the first two audio channels from the first input, and using the
trailing @code{?}, ignore the audio channel mapping if the first input is
mono instead of stereo:
@example
ffmpeg -i INPUT -map_channel 0.0.0 -map_channel 0.0.1? OUTPUT
@end example
@item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata})
Set metadata information of the next output file from @var{infile}. Note that
those are file indices (zero-based), not filenames.

View File

@ -51,10 +51,6 @@
#include "libswresample/swresample.h"
// deprecated features
#define FFMPEG_OPT_PSNR 1
#define FFMPEG_OPT_MAP_CHANNEL 1
#define FFMPEG_OPT_MAP_SYNC 1
#define FFMPEG_ROTATION_METADATA 1
#define FFMPEG_OPT_QPHIST 1
#define FFMPEG_OPT_ADRIFT_THRESHOLD 1
#define FFMPEG_OPT_ENC_TIME_BASE_NUM 1
@ -124,13 +120,6 @@ typedef struct StreamMap {
char *linklabel; /* name of an output link, for mapping lavfi outputs */
} StreamMap;
#if FFMPEG_OPT_MAP_CHANNEL
typedef struct {
int file_idx, stream_idx, channel_idx; // input
int ofile_idx, ostream_idx; // output
} AudioChannelMap;
#endif
typedef struct OptionsContext {
OptionGroup *g;
@ -170,10 +159,6 @@ typedef struct OptionsContext {
/* output options */
StreamMap *stream_maps;
int nb_stream_maps;
#if FFMPEG_OPT_MAP_CHANNEL
AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */
int nb_audio_channel_maps; /* number of (valid) -map_channel settings */
#endif
const char **attachments;
int nb_attachments;
@ -539,27 +524,15 @@ typedef struct OutputStream {
int force_fps;
#if FFMPEG_OPT_TOP
int top_field_first;
#endif
#if FFMPEG_ROTATION_METADATA
int rotate_overridden;
#endif
int autoscale;
int bitexact;
int bits_per_raw_sample;
#if FFMPEG_ROTATION_METADATA
double rotate_override_value;
#endif
AVRational frame_aspect_ratio;
KeyframeForceCtx kf;
/* audio only */
#if FFMPEG_OPT_MAP_CHANNEL
int *audio_channels_map; /* list of the channels id to pick from the source stream */
int audio_channels_mapped; /* number of channels in audio_channels_map */
#endif
char *logfile_prefix;
FILE *logfile;
@ -684,10 +657,6 @@ extern int recast_media;
extern FILE *vstats_file;
#if FFMPEG_OPT_PSNR
extern int do_psnr;
#endif
void term_init(void);
void term_exit(void);

View File

@ -1364,19 +1364,6 @@ static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph,
pad_idx = 0; \
} while (0)
av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED);
#if FFMPEG_OPT_MAP_CHANNEL
if (ost->audio_channels_mapped) {
AVChannelLayout mapped_layout = { 0 };
av_channel_layout_default(&mapped_layout, ost->audio_channels_mapped);
av_channel_layout_describe_bprint(&mapped_layout, &args);
for (int i = 0; i < ost->audio_channels_mapped; i++)
if (ost->audio_channels_map[i] != -1)
av_bprintf(&args, "|c%d=c%d", i, ost->audio_channels_map[i]);
AUTO_INSERT_FILTER("-map_channel", "pan", args.str);
av_bprint_clear(&args);
}
#endif
choose_sample_fmts(ofp, &args);
choose_sample_rates(ofp, &args);

View File

@ -818,11 +818,6 @@ static void ost_free(OutputStream **post)
av_freep(&ost->attachment_filename);
#if FFMPEG_OPT_MAP_CHANNEL
av_freep(&ost->audio_channels_map);
ost->audio_channels_mapped = 0;
#endif
av_dict_free(&ost->sws_dict);
av_dict_free(&ost->swr_opts);

View File

@ -706,13 +706,6 @@ static int new_stream_video(Muxer *mux, const OptionsContext *o,
}
video_enc->rc_override_count = i;
#if FFMPEG_OPT_PSNR
if (do_psnr) {
av_log(ost, AV_LOG_WARNING, "The -psnr option is deprecated, use -flags +psnr\n");
video_enc->flags|= AV_CODEC_FLAG_PSNR;
}
#endif
/* two pass mode */
MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st);
if (do_pass) {
@ -832,10 +825,7 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o,
OutputStream *ost)
{
AVFormatContext *oc = mux->fc;
AVStream *st;
int ret = 0;
st = ost->st;
AVStream *st = ost->st;
if (ost->enc_ctx) {
AVCodecContext *audio_enc = ost->enc_ctx;
@ -881,37 +871,6 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o,
MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st);
ost->apad = av_strdup(ost->apad);
#if FFMPEG_OPT_MAP_CHANNEL
/* check for channel mapping for this audio stream */
for (int n = 0; n < o->nb_audio_channel_maps; n++) {
AudioChannelMap *map = &o->audio_channel_maps[n];
if ((map->ofile_idx == -1 || ost->file->index == map->ofile_idx) &&
(map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) {
InputStream *ist;
if (map->channel_idx == -1) {
ist = NULL;
} else if (!ost->ist) {
av_log(ost, AV_LOG_FATAL, "Cannot determine input stream for channel mapping %d.%d\n",
ost->file->index, ost->st->index);
continue;
} else {
ist = ost->ist;
}
if (!ist || (ist->file->index == map->file_idx && ist->index == map->stream_idx)) {
ret = av_reallocp_array(&ost->audio_channels_map,
ost->audio_channels_mapped + 1,
sizeof(*ost->audio_channels_map));
if (ret < 0)
return ret;
ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx;
}
}
}
#endif
}
return 0;
@ -1049,17 +1008,6 @@ static int streamcopy_init(const Muxer *mux, OutputStream *ost)
memcpy(sd_dst->data, sd_src->data, sd_src->size);
}
#if FFMPEG_ROTATION_METADATA
if (ost->rotate_overridden) {
AVPacketSideData *sd = av_packet_side_data_new(&ost->st->codecpar->coded_side_data,
&ost->st->codecpar->nb_coded_side_data,
AV_PKT_DATA_DISPLAYMATRIX,
sizeof(int32_t) * 9, 0);
if (sd)
av_display_rotation_set((int32_t *)sd->data, -ost->rotate_override_value);
}
#endif
switch (par->codec_type) {
case AVMEDIA_TYPE_AUDIO:
if ((par->block_align == 1 || par->block_align == 1152 || par->block_align == 576) &&
@ -2479,28 +2427,8 @@ static int of_add_metadata(OutputFile *of, AVFormatContext *oc,
if (type == 's') {
for (int j = 0; j < oc->nb_streams; j++) {
OutputStream *ost = of->streams[j];
if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) {
#if FFMPEG_ROTATION_METADATA
if (!strcmp(o->metadata.opt[i].u.str, "rotate")) {
char *tail;
double theta = av_strtod(val, &tail);
if (!*tail) {
ost->rotate_overridden = 1;
ost->rotate_override_value = theta;
}
av_log(ost, AV_LOG_WARNING,
"Conversion of a 'rotate' metadata key to a "
"proper display matrix rotation is deprecated. "
"See -display_rotation for setting rotation "
"instead.");
} else {
#endif
av_dict_set(&oc->streams[j]->metadata, o->metadata.opt[i].u.str, *val ? val : NULL, 0);
#if FFMPEG_ROTATION_METADATA
}
#endif
av_dict_set(&oc->streams[j]->metadata, o->metadata.opt[i].u.str, *val ? val : NULL, 0);
} else if (ret < 0)
return ret;
}

View File

@ -88,9 +88,6 @@ int64_t stats_period = 500000;
static int file_overwrite = 0;
static int no_file_overwrite = 0;
#if FFMPEG_OPT_PSNR
int do_psnr = 0;
#endif
int ignore_unknown_streams = 0;
int copy_unknown_streams = 0;
int recast_media = 0;
@ -121,9 +118,6 @@ static void uninit_options(OptionsContext *o)
for (i = 0; i < o->nb_stream_maps; i++)
av_freep(&o->stream_maps[i].linklabel);
av_freep(&o->stream_maps);
#if FFMPEG_OPT_MAP_CHANNEL
av_freep(&o->audio_channel_maps);
#endif
for (i = 0; i < o->nb_attachments; i++)
av_freep(&o->attachments[i]);
@ -403,19 +397,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
if (!map)
return AVERROR(ENOMEM);
#if FFMPEG_OPT_MAP_SYNC
{
/* parse sync stream first, just pick first matching stream */
char *sync = strchr(map, ',');
if (sync) {
*sync = 0;
av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n");
}
}
#endif
if (map[0] == '[') {
/* this mapping refers to lavfi output */
const char *c = map + 1;
@ -505,99 +486,6 @@ static int opt_attach(void *optctx, const char *opt, const char *arg)
return 0;
}
#if FFMPEG_OPT_MAP_CHANNEL
static int opt_map_channel(void *optctx, const char *opt, const char *arg)
{
OptionsContext *o = optctx;
int n, ret;
AVStream *st;
AudioChannelMap *m;
char *allow_unused;
char *mapchan;
av_log(NULL, AV_LOG_WARNING,
"The -%s option is deprecated and will be removed. "
"It can be replaced by the 'pan' filter, or in some cases by "
"combinations of 'channelsplit', 'channelmap', 'amerge' filters.\n", opt);
mapchan = av_strdup(arg);
if (!mapchan)
return AVERROR(ENOMEM);
ret = GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps);
if (ret < 0)
goto end;
m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1];
/* muted channel syntax */
n = sscanf(arg, "%d:%d.%d", &m->channel_idx, &m->ofile_idx, &m->ostream_idx);
if ((n == 1 || n == 3) && m->channel_idx == -1) {
m->file_idx = m->stream_idx = -1;
if (n == 1)
m->ofile_idx = m->ostream_idx = -1;
av_free(mapchan);
return 0;
}
/* normal syntax */
n = sscanf(arg, "%d.%d.%d:%d.%d",
&m->file_idx, &m->stream_idx, &m->channel_idx,
&m->ofile_idx, &m->ostream_idx);
if (n != 3 && n != 5) {
av_log(NULL, AV_LOG_FATAL, "Syntax error, mapchan usage: "
"[file.stream.channel|-1][:syncfile:syncstream]\n");
goto fail;
}
if (n != 5) // only file.stream.channel specified
m->ofile_idx = m->ostream_idx = -1;
/* check input */
if (m->file_idx < 0 || m->file_idx >= nb_input_files) {
av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file index: %d\n",
m->file_idx);
goto fail;
}
if (m->stream_idx < 0 ||
m->stream_idx >= input_files[m->file_idx]->nb_streams) {
av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file stream index #%d.%d\n",
m->file_idx, m->stream_idx);
goto fail;
}
st = input_files[m->file_idx]->ctx->streams[m->stream_idx];
if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
av_log(NULL, AV_LOG_FATAL, "mapchan: stream #%d.%d is not an audio stream.\n",
m->file_idx, m->stream_idx);
goto fail;
}
/* allow trailing ? to map_channel */
if (allow_unused = strchr(mapchan, '?'))
*allow_unused = 0;
if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->ch_layout.nb_channels ||
input_files[m->file_idx]->streams[m->stream_idx]->user_set_discard == AVDISCARD_ALL) {
if (allow_unused) {
av_log(NULL, AV_LOG_VERBOSE, "mapchan: invalid audio channel #%d.%d.%d\n",
m->file_idx, m->stream_idx, m->channel_idx);
} else {
av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n"
"To ignore this, add a trailing '?' to the map_channel.\n",
m->file_idx, m->stream_idx, m->channel_idx);
goto fail;
}
}
ret = 0;
end:
av_free(mapchan);
return ret;
fail:
ret = AVERROR(EINVAL);
goto end;
}
#endif
static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
{
Scheduler *sch = optctx;
@ -2005,21 +1893,11 @@ const OptionDef options[] = {
"set hardware device used when filtering", "device" },
// deprecated options
#if FFMPEG_OPT_MAP_CHANNEL
{ "map_channel", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT,
{ .func_arg = opt_map_channel },
"map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" },
#endif
#if FFMPEG_OPT_ADRIFT_THRESHOLD
{ "adrift_threshold", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
{ .func_arg = opt_adrift_threshold },
"deprecated, does nothing", "threshold" },
#endif
#if FFMPEG_OPT_PSNR
{ "psnr", OPT_TYPE_BOOL, OPT_VIDEO | OPT_EXPERT,
{ &do_psnr },
"calculate PSNR of compressed frames (deprecated, use -flags +psnr)" },
#endif
#if FFMPEG_OPT_TOP
{ "top", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT,
{ .off = OFFSET(top_field_first) },

View File

@ -1,28 +1,3 @@
FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV, MD5_PROTOCOL) += fate-mapchan-6ch-extract-2
fate-mapchan-6ch-extract-2: tests/data/asynth-22050-6.wav
fate-mapchan-6ch-extract-2: CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-22050-6.wav -map_channel 0.0.0 -fflags +bitexact -f wav md5: -map_channel 0.0.1 -fflags +bitexact -f wav md5:
FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN ARESAMPLE, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-6ch-extract-2-downmix-mono
fate-mapchan-6ch-extract-2-downmix-mono: tests/data/asynth-22050-6.wav
fate-mapchan-6ch-extract-2-downmix-mono: CMD = md5 -auto_conversion_filters -i $(TARGET_PATH)/tests/data/asynth-22050-6.wav -map_channel 0.0.1 -map_channel 0.0.0 -ac 1 -fflags +bitexact -f wav
FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-silent-mono
fate-mapchan-silent-mono: tests/data/asynth-22050-1.wav
fate-mapchan-silent-mono: CMD = md5 -i $(TARGET_PATH)/tests/data/asynth-22050-1.wav -map_channel -1 -map_channel 0.0.0 -fflags +bitexact -f wav
FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-2ch-extract-ch0-ch2-trailing
fate-mapchan-2ch-extract-ch0-ch2-trailing: tests/data/asynth-44100-2.wav
fate-mapchan-2ch-extract-ch0-ch2-trailing: CMD = md5 -i $(TARGET_PATH)/tests/data/asynth-44100-2.wav -map_channel 0.0.0 -map_channel 0.0.2? -fflags +bitexact -f wav
FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-3ch-extract-ch0-ch2-trailing
fate-mapchan-3ch-extract-ch0-ch2-trailing: tests/data/asynth-44100-3.wav
fate-mapchan-3ch-extract-ch0-ch2-trailing: CMD = md5 -i $(TARGET_PATH)/tests/data/asynth-44100-3.wav -map_channel 0.0.0 -map_channel 0.0.2? -fflags +bitexact -f wav
FATE_MAPCHAN = $(FATE_MAPCHAN-yes)
FATE_FFMPEG += $(FATE_MAPCHAN)
fate-mapchan: $(FATE_MAPCHAN)
FATE_FFMPEG-$(call FILTERFRAMECRC, COLOR) += fate-ffmpeg-filter_complex
fate-ffmpeg-filter_complex: CMD = framecrc -filter_complex color=d=1:r=5 -fflags +bitexact