Unified · Split
| @@ -28,6 +28,7 @@ version <next>: · 27 unmodified lines | |||
| 28 | will be bumped to C17 in the near future, so consider updating your | 28 | will be bumped to C17 in the near future, so consider updating your |
| 29 | build environment if it lacks C17 support | 29 | build environment if it lacks C17 support |
| 30 | - Change the default bitrate control method from VBR to CQP for QSV encoders. | 30 | - Change the default bitrate control method from VBR to CQP for QSV encoders. |
| 31 | - removed deprecated ffmpeg CLI options -psnr and -map_channel | ||
| 31 | 32 | ||
| 32 | version 6.1: | 33 | version 6.1: |
| 33 | - libaribcaption decoder | 34 | - libaribcaption decoder |
| @@ -1230,10 +1230,6 @@ list separated with slashes. Two first values are the beginning and · 1229 unmodified lines | |||
| 1230 | end frame numbers, last one is quantizer to use if positive, or quality | 1230 | end frame numbers, last one is quantizer to use if positive, or quality |
| 1231 | factor if negative. | 1231 | factor if negative. |
| 1232 | 1232 | ||
| 1233 | @item -psnr | ||
| 1234 | Calculate PSNR of compressed frames. This option is deprecated, pass the | ||
| 1235 | PSNR flag to the encoder instead, using @code{-flags +psnr}. | ||
| 1236 | |||
| 1237 | @item -vstats | 1233 | @item -vstats |
| 1238 | Dump video coding statistics to @file{vstats_HHMMSS.log}. See the | 1234 | Dump video coding statistics to @file{vstats_HHMMSS.log}. See the |
| 1239 | @ref{vstats_file_format,,vstats file format} section for the format description. | 1235 | @ref{vstats_file_format,,vstats file format} section for the format description. |
| @@ -1806,77 +1802,6 @@ such streams is attempted. · 566 unmodified lines | |||
| 1806 | Allow input streams with unknown type to be copied instead of failing if copying | 1802 | Allow input streams with unknown type to be copied instead of failing if copying |
| 1807 | such streams is attempted. | 1803 | such streams is attempted. |
| 1808 | 1804 | ||
| 1809 | @item -map_channel [@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][?][:@var{output_file_id}.@var{stream_specifier}] | ||
| 1810 | This option is deprecated and will be removed. It can be replaced by the | ||
| 1811 | @var{pan} filter. In some cases it may be easier to use some combination of the | ||
| 1812 | @var{channelsplit}, @var{channelmap}, or @var{amerge} filters. | ||
| 1813 | |||
| 1814 | Map an audio channel from a given input to an output. If | ||
| 1815 | @var{output_file_id}.@var{stream_specifier} is not set, the audio channel will | ||
| 1816 | be mapped on all the audio streams. | ||
| 1817 | |||
| 1818 | Using "-1" instead of | ||
| 1819 | @var{input_file_id}.@var{stream_specifier}.@var{channel_id} will map a muted | ||
| 1820 | channel. | ||
| 1821 | |||
| 1822 | A trailing @code{?} will allow the map_channel to be | ||
| 1823 | optional: if the map_channel matches no channel the map_channel will be ignored instead | ||
| 1824 | of failing. | ||
| 1825 | |||
| 1826 | For example, assuming @var{INPUT} is a stereo audio file, you can switch the | ||
| 1827 | two audio channels with the following command: | ||
| 1828 | @example | ||
| 1829 | ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT | ||
| 1830 | @end example | ||
| 1831 | |||
| 1832 | If you want to mute the first channel and keep the second: | ||
| 1833 | @example | ||
| 1834 | ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT | ||
| 1835 | @end example | ||
| 1836 | |||
| 1837 | The order of the "-map_channel" option specifies the order of the channels in | ||
| 1838 | the output stream. The output channel layout is guessed from the number of | ||
| 1839 | channels mapped (mono if one "-map_channel", stereo if two, etc.). Using "-ac" | ||
| 1840 | in combination of "-map_channel" makes the channel gain levels to be updated if | ||
| 1841 | input and output channel layouts don't match (for instance two "-map_channel" | ||
| 1842 | options and "-ac 6"). | ||
| 1843 | |||
| 1844 | You can also extract each channel of an input to specific outputs; the following | ||
| 1845 | command extracts two channels of the @var{INPUT} audio stream (file 0, stream 0) | ||
| 1846 | to the respective @var{OUTPUT_CH0} and @var{OUTPUT_CH1} outputs: | ||
| 1847 | @example | ||
| 1848 | ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1 | ||
| 1849 | @end example | ||
| 1850 | |||
| 1851 | The following example splits the channels of a stereo input into two separate | ||
| 1852 | streams, which are put into the same output file: | ||
| 1853 | @example | ||
| 1854 | 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 | ||
| 1855 | @end example | ||
| 1856 | |||
| 1857 | Note that currently each output stream can only contain channels from a single | ||
| 1858 | input stream; you can't for example use "-map_channel" to pick multiple input | ||
| 1859 | audio channels contained in different streams (from the same or different files) | ||
| 1860 | and merge them into a single output stream. It is therefore not currently | ||
| 1861 | possible, for example, to turn two separate mono streams into a single stereo | ||
| 1862 | stream. However splitting a stereo stream into two single channel mono streams | ||
| 1863 | is possible. | ||
| 1864 | |||
| 1865 | If you need this feature, a possible workaround is to use the @emph{amerge} | ||
| 1866 | filter. For example, if you need to merge a media (here @file{input.mkv}) with 2 | ||
| 1867 | mono audio streams into one single stereo channel audio stream (and keep the | ||
| 1868 | video stream), you can use the following command: | ||
| 1869 | @example | ||
| 1870 | ffmpeg -i input.mkv -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le -c:v copy output.mkv | ||
| 1871 | @end example | ||
| 1872 | |||
| 1873 | To map the first two audio channels from the first input, and using the | ||
| 1874 | trailing @code{?}, ignore the audio channel mapping if the first input is | ||
| 1875 | mono instead of stereo: | ||
| 1876 | @example | ||
| 1877 | ffmpeg -i INPUT -map_channel 0.0.0 -map_channel 0.0.1? OUTPUT | ||
| 1878 | @end example | ||
| 1879 | |||
| 1880 | @item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata}) | 1805 | @item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata}) |
| 1881 | Set metadata information of the next output file from @var{infile}. Note that | 1806 | Set metadata information of the next output file from @var{infile}. Note that |
| 1882 | those are file indices (zero-based), not filenames. | 1807 | those are file indices (zero-based), not filenames. |
| @@ -51,10 +51,6 @@ · 50 unmodified lines | |||
| 51 | #include "libswresample/swresample.h" | 51 | #include "libswresample/swresample.h" |
| 52 | 52 | ||
| 53 | // deprecated features | 53 | // deprecated features |
| 54 | #define FFMPEG_OPT_PSNR 1 | ||
| 55 | #define FFMPEG_OPT_MAP_CHANNEL 1 | ||
| 56 | #define FFMPEG_OPT_MAP_SYNC 1 | ||
| 57 | #define FFMPEG_ROTATION_METADATA 1 | ||
| 58 | #define FFMPEG_OPT_QPHIST 1 | 54 | #define FFMPEG_OPT_QPHIST 1 |
| 59 | #define FFMPEG_OPT_ADRIFT_THRESHOLD 1 | 55 | #define FFMPEG_OPT_ADRIFT_THRESHOLD 1 |
| 60 | #define FFMPEG_OPT_ENC_TIME_BASE_NUM 1 | 56 | #define FFMPEG_OPT_ENC_TIME_BASE_NUM 1 |
| @@ -124,13 +120,6 @@ typedef struct StreamMap { · 63 unmodified lines | |||
| 124 | char *linklabel; /* name of an output link, for mapping lavfi outputs */ | 120 | char *linklabel; /* name of an output link, for mapping lavfi outputs */ |
| 125 | } StreamMap; | 121 | } StreamMap; |
| 126 | 122 | ||
| 127 | #if FFMPEG_OPT_MAP_CHANNEL | ||
| 128 | typedef struct { | ||
| 129 | int file_idx, stream_idx, channel_idx; // input | ||
| 130 | int ofile_idx, ostream_idx; // output | ||
| 131 | } AudioChannelMap; | ||
| 132 | #endif | ||
| 133 | |||
| 134 | typedef struct OptionsContext { | 123 | typedef struct OptionsContext { |
| 135 | OptionGroup *g; | 124 | OptionGroup *g; |
| 136 | 125 | ||
| @@ -170,10 +159,6 @@ typedef struct OptionsContext { · 33 unmodified lines | |||
| 170 | /* output options */ | 159 | /* output options */ |
| 171 | StreamMap *stream_maps; | 160 | StreamMap *stream_maps; |
| 172 | int nb_stream_maps; | 161 | int nb_stream_maps; |
| 173 | #if FFMPEG_OPT_MAP_CHANNEL | ||
| 174 | AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */ | ||
| 175 | int nb_audio_channel_maps; /* number of (valid) -map_channel settings */ | ||
| 176 | #endif | ||
| 177 | const char **attachments; | 162 | const char **attachments; |
| 178 | int nb_attachments; | 163 | int nb_attachments; |
| 179 | 164 | ||
| @@ -539,27 +524,15 @@ typedef struct OutputStream { · 359 unmodified lines | |||
| 539 | int force_fps; | 524 | int force_fps; |
| 540 | #if FFMPEG_OPT_TOP | 525 | #if FFMPEG_OPT_TOP |
| 541 | int top_field_first; | 526 | int top_field_first; |
| 542 | #endif | ||
| 543 | #if FFMPEG_ROTATION_METADATA | ||
| 544 | int rotate_overridden; | ||
| 545 | #endif | 527 | #endif |
| 546 | int autoscale; | 528 | int autoscale; |
| 547 | int bitexact; | 529 | int bitexact; |
| 548 | int bits_per_raw_sample; | 530 | int bits_per_raw_sample; |
| 549 | #if FFMPEG_ROTATION_METADATA | ||
| 550 | double rotate_override_value; | ||
| 551 | #endif | ||
| 552 | 531 | ||
| 553 | AVRational frame_aspect_ratio; | 532 | AVRational frame_aspect_ratio; |
| 554 | 533 | ||
| 555 | KeyframeForceCtx kf; | 534 | KeyframeForceCtx kf; |
| 556 | 535 | ||
| 557 | /* audio only */ | ||
| 558 | #if FFMPEG_OPT_MAP_CHANNEL | ||
| 559 | int *audio_channels_map; /* list of the channels id to pick from the source stream */ | ||
| 560 | int audio_channels_mapped; /* number of channels in audio_channels_map */ | ||
| 561 | #endif | ||
| 562 | |||
| 563 | char *logfile_prefix; | 536 | char *logfile_prefix; |
| 564 | FILE *logfile; | 537 | FILE *logfile; |
| 565 | 538 | ||
| @@ -684,10 +657,6 @@ extern int recast_media; · 118 unmodified lines | |||
| 684 | 657 | ||
| 685 | extern FILE *vstats_file; | 658 | extern FILE *vstats_file; |
| 686 | 659 | ||
| 687 | #if FFMPEG_OPT_PSNR | ||
| 688 | extern int do_psnr; | ||
| 689 | #endif | ||
| 690 | |||
| 691 | void term_init(void); | 660 | void term_init(void); |
| 692 | void term_exit(void); | 661 | void term_exit(void); |
| 693 | 662 | ||
| @@ -1364,19 +1364,6 @@ static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph, · 1363 unmodified lines | |||
| 1364 | pad_idx = 0; \ | 1364 | pad_idx = 0; \ |
| 1365 | } while (0) | 1365 | } while (0) |
| 1366 | av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED); | 1366 | av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED); |
| 1367 | #if FFMPEG_OPT_MAP_CHANNEL | ||
| 1368 | if (ost->audio_channels_mapped) { | ||
| 1369 | AVChannelLayout mapped_layout = { 0 }; | ||
| 1370 | av_channel_layout_default(&mapped_layout, ost->audio_channels_mapped); | ||
| 1371 | av_channel_layout_describe_bprint(&mapped_layout, &args); | ||
| 1372 | for (int i = 0; i < ost->audio_channels_mapped; i++) | ||
| 1373 | if (ost->audio_channels_map[i] != -1) | ||
| 1374 | av_bprintf(&args, "|c%d=c%d", i, ost->audio_channels_map[i]); | ||
| 1375 | |||
| 1376 | AUTO_INSERT_FILTER("-map_channel", "pan", args.str); | ||
| 1377 | av_bprint_clear(&args); | ||
| 1378 | } | ||
| 1379 | #endif | ||
| 1380 | 1367 | ||
| 1381 | choose_sample_fmts(ofp, &args); | 1368 | choose_sample_fmts(ofp, &args); |
| 1382 | choose_sample_rates(ofp, &args); | 1369 | choose_sample_rates(ofp, &args); |
| @@ -818,11 +818,6 @@ static void ost_free(OutputStream **post) · 817 unmodified lines | |||
| 818 | 818 | ||
| 819 | av_freep(&ost->attachment_filename); | 819 | av_freep(&ost->attachment_filename); |
| 820 | 820 | ||
| 821 | #if FFMPEG_OPT_MAP_CHANNEL | ||
| 822 | av_freep(&ost->audio_channels_map); | ||
| 823 | ost->audio_channels_mapped = 0; | ||
| 824 | #endif | ||
| 825 | |||
| 826 | av_dict_free(&ost->sws_dict); | 821 | av_dict_free(&ost->sws_dict); |
| 827 | av_dict_free(&ost->swr_opts); | 822 | av_dict_free(&ost->swr_opts); |
| 828 | 823 | ||
| @@ -706,13 +706,6 @@ static int new_stream_video(Muxer *mux, const OptionsContext *o, · 705 unmodified lines | |||
| 706 | } | 706 | } |
| 707 | video_enc->rc_override_count = i; | 707 | video_enc->rc_override_count = i; |
| 708 | 708 | ||
| 709 | #if FFMPEG_OPT_PSNR | ||
| 710 | if (do_psnr) { | ||
| 711 | av_log(ost, AV_LOG_WARNING, "The -psnr option is deprecated, use -flags +psnr\n"); | ||
| 712 | video_enc->flags|= AV_CODEC_FLAG_PSNR; | ||
| 713 | } | ||
| 714 | #endif | ||
| 715 | |||
| 716 | /* two pass mode */ | 709 | /* two pass mode */ |
| 717 | MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st); | 710 | MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st); |
| 718 | if (do_pass) { | 711 | if (do_pass) { |
| @@ -832,10 +825,7 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, · 113 unmodified lines | |||
| 832 | OutputStream *ost) | 825 | OutputStream *ost) |
| 833 | { | 826 | { |
| 834 | AVFormatContext *oc = mux->fc; | 827 | AVFormatContext *oc = mux->fc; |
| 835 | AVStream *st; | 828 | AVStream *st = ost->st; |
| 836 | int ret = 0; | ||
| 837 | |||
| 838 | st = ost->st; | ||
| 839 | 829 | ||
| 840 | if (ost->enc_ctx) { | 830 | if (ost->enc_ctx) { |
| 841 | AVCodecContext *audio_enc = ost->enc_ctx; | 831 | AVCodecContext *audio_enc = ost->enc_ctx; |
| @@ -881,37 +871,6 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, · 39 unmodified lines | |||
| 881 | 871 | ||
| 882 | MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st); | 872 | MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st); |
| 883 | ost->apad = av_strdup(ost->apad); | 873 | ost->apad = av_strdup(ost->apad); |
| 884 | |||
| 885 | #if FFMPEG_OPT_MAP_CHANNEL | ||
| 886 | /* check for channel mapping for this audio stream */ | ||
| 887 | for (int n = 0; n < o->nb_audio_channel_maps; n++) { | ||
| 888 | AudioChannelMap *map = &o->audio_channel_maps[n]; | ||
| 889 | if ((map->ofile_idx == -1 || ost->file->index == map->ofile_idx) && | ||
| 890 | (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) { | ||
| 891 | InputStream *ist; | ||
| 892 | |||
| 893 | if (map->channel_idx == -1) { | ||
| 894 | ist = NULL; | ||
| 895 | } else if (!ost->ist) { | ||
| 896 | av_log(ost, AV_LOG_FATAL, "Cannot determine input stream for channel mapping %d.%d\n", | ||
| 897 | ost->file->index, ost->st->index); | ||
| 898 | continue; | ||
| 899 | } else { | ||
| 900 | ist = ost->ist; | ||
| 901 | } | ||
| 902 | |||
| 903 | if (!ist || (ist->file->index == map->file_idx && ist->index == map->stream_idx)) { | ||
| 904 | ret = av_reallocp_array(&ost->audio_channels_map, | ||
| 905 | ost->audio_channels_mapped + 1, | ||
| 906 | sizeof(*ost->audio_channels_map)); | ||
| 907 | if (ret < 0) | ||
| 908 | return ret; | ||
| 909 | |||
| 910 | ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx; | ||
| 911 | } | ||
| 912 | } | ||
| 913 | } | ||
| 914 | #endif | ||
| 915 | } | 874 | } |
| 916 | 875 | ||
| 917 | return 0; | 876 | return 0; |
| @@ -1049,17 +1008,6 @@ static int streamcopy_init(const Muxer *mux, OutputStream *ost) · 131 unmodified lines | |||
| 1049 | memcpy(sd_dst->data, sd_src->data, sd_src->size); | 1008 | memcpy(sd_dst->data, sd_src->data, sd_src->size); |
| 1050 | } | 1009 | } |
| 1051 | 1010 | ||
| 1052 | #if FFMPEG_ROTATION_METADATA | ||
| 1053 | if (ost->rotate_overridden) { | ||
| 1054 | AVPacketSideData *sd = av_packet_side_data_new(&ost->st->codecpar->coded_side_data, | ||
| 1055 | &ost->st->codecpar->nb_coded_side_data, | ||
| 1056 | AV_PKT_DATA_DISPLAYMATRIX, | ||
| 1057 | sizeof(int32_t) * 9, 0); | ||
| 1058 | if (sd) | ||
| 1059 | av_display_rotation_set((int32_t *)sd->data, -ost->rotate_override_value); | ||
| 1060 | } | ||
| 1061 | #endif | ||
| 1062 | |||
| 1063 | switch (par->codec_type) { | 1011 | switch (par->codec_type) { |
| 1064 | case AVMEDIA_TYPE_AUDIO: | 1012 | case AVMEDIA_TYPE_AUDIO: |
| 1065 | if ((par->block_align == 1 || par->block_align == 1152 || par->block_align == 576) && | 1013 | 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, · 1413 unmodified lines | |||
| 2479 | 2427 | ||
| 2480 | if (type == 's') { | 2428 | if (type == 's') { |
| 2481 | for (int j = 0; j < oc->nb_streams; j++) { | 2429 | for (int j = 0; j < oc->nb_streams; j++) { |
| 2482 | OutputStream *ost = of->streams[j]; | ||
| 2483 | if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) { | 2430 | if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) { |
| 2484 | #if FFMPEG_ROTATION_METADATA | 2431 | av_dict_set(&oc->streams[j]->metadata, o->metadata.opt[i].u.str, *val ? val : NULL, 0); |
| 2485 | if (!strcmp(o->metadata.opt[i].u.str, "rotate")) { | ||
| 2486 | char *tail; | ||
| 2487 | double theta = av_strtod(val, &tail); | ||
| 2488 | if (!*tail) { | ||
| 2489 | ost->rotate_overridden = 1; | ||
| 2490 | ost->rotate_override_value = theta; | ||
| 2491 | } | ||
| 2492 | |||
| 2493 | av_log(ost, AV_LOG_WARNING, | ||
| 2494 | "Conversion of a 'rotate' metadata key to a " | ||
| 2495 | "proper display matrix rotation is deprecated. " | ||
| 2496 | "See -display_rotation for setting rotation " | ||
| 2497 | "instead."); | ||
| 2498 | } else { | ||
| 2499 | #endif | ||
| 2500 | av_dict_set(&oc->streams[j]->metadata, o->metadata.opt[i].u.str, *val ? val : NULL, 0); | ||
| 2501 | #if FFMPEG_ROTATION_METADATA | ||
| 2502 | } | ||
| 2503 | #endif | ||
| 2504 | } else if (ret < 0) | 2432 | } else if (ret < 0) |
| 2505 | return ret; | 2433 | return ret; |
| 2506 | } | 2434 | } |
| @@ -88,9 +88,6 @@ int64_t stats_period = 500000; · 87 unmodified lines | |||
| 88 | 88 | ||
| 89 | static int file_overwrite = 0; | 89 | static int file_overwrite = 0; |
| 90 | static int no_file_overwrite = 0; | 90 | static int no_file_overwrite = 0; |
| 91 | #if FFMPEG_OPT_PSNR | ||
| 92 | int do_psnr = 0; | ||
| 93 | #endif | ||
| 94 | int ignore_unknown_streams = 0; | 91 | int ignore_unknown_streams = 0; |
| 95 | int copy_unknown_streams = 0; | 92 | int copy_unknown_streams = 0; |
| 96 | int recast_media = 0; | 93 | int recast_media = 0; |
| @@ -121,9 +118,6 @@ static void uninit_options(OptionsContext *o) · 24 unmodified lines | |||
| 121 | for (i = 0; i < o->nb_stream_maps; i++) | 118 | for (i = 0; i < o->nb_stream_maps; i++) |
| 122 | av_freep(&o->stream_maps[i].linklabel); | 119 | av_freep(&o->stream_maps[i].linklabel); |
| 123 | av_freep(&o->stream_maps); | 120 | av_freep(&o->stream_maps); |
| 124 | #if FFMPEG_OPT_MAP_CHANNEL | ||
| 125 | av_freep(&o->audio_channel_maps); | ||
| 126 | #endif | ||
| 127 | 121 | ||
| 128 | for (i = 0; i < o->nb_attachments; i++) | 122 | for (i = 0; i < o->nb_attachments; i++) |
| 129 | av_freep(&o->attachments[i]); | 123 | av_freep(&o->attachments[i]); |
| @@ -403,19 +397,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg) · 273 unmodified lines | |||
| 403 | if (!map) | 397 | if (!map) |
| 404 | return AVERROR(ENOMEM); | 398 | return AVERROR(ENOMEM); |
| 405 | 399 | ||
| 406 | #if FFMPEG_OPT_MAP_SYNC | ||
| 407 | { | ||
| 408 | /* parse sync stream first, just pick first matching stream */ | ||
| 409 | char *sync = strchr(map, ','); | ||
| 410 | |||
| 411 | if (sync) { | ||
| 412 | *sync = 0; | ||
| 413 | av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n"); | ||
| 414 | } | ||
| 415 | } | ||
| 416 | #endif | ||
| 417 | |||
| 418 | |||
| 419 | if (map[0] == '[') { | 400 | if (map[0] == '[') { |
| 420 | /* this mapping refers to lavfi output */ | 401 | /* this mapping refers to lavfi output */ |
| 421 | const char *c = map + 1; | 402 | const char *c = map + 1; |
| @@ -505,99 +486,6 @@ static int opt_attach(void *optctx, const char *opt, const char *arg) · 83 unmodified lines | |||
| 505 | return 0; | 486 | return 0; |
| 506 | } | 487 | } |
| 507 | 488 | ||
| 508 | #if FFMPEG_OPT_MAP_CHANNEL | ||
| 509 | static int opt_map_channel(void *optctx, const char *opt, const char *arg) | ||
| 510 | { | ||
| 511 | OptionsContext *o = optctx; | ||
| 512 | int n, ret; | ||
| 513 | AVStream *st; | ||
| 514 | AudioChannelMap *m; | ||
| 515 | char *allow_unused; | ||
| 516 | char *mapchan; | ||
| 517 | |||
| 518 | av_log(NULL, AV_LOG_WARNING, | ||
| 519 | "The -%s option is deprecated and will be removed. " | ||
| 520 | "It can be replaced by the 'pan' filter, or in some cases by " | ||
| 521 | "combinations of 'channelsplit', 'channelmap', 'amerge' filters.\n", opt); | ||
| 522 | |||
| 523 | mapchan = av_strdup(arg); | ||
| 524 | if (!mapchan) | ||
| 525 | return AVERROR(ENOMEM); | ||
| 526 | |||
| 527 | ret = GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps); | ||
| 528 | if (ret < 0) | ||
| 529 | goto end; | ||
| 530 | |||
| 531 | m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1]; | ||
| 532 | |||
| 533 | /* muted channel syntax */ | ||
| 534 | n = sscanf(arg, "%d:%d.%d", &m->channel_idx, &m->ofile_idx, &m->ostream_idx); | ||
| 535 | if ((n == 1 || n == 3) && m->channel_idx == -1) { | ||
| 536 | m->file_idx = m->stream_idx = -1; | ||
| 537 | if (n == 1) | ||
| 538 | m->ofile_idx = m->ostream_idx = -1; | ||
| 539 | av_free(mapchan); | ||
| 540 | return 0; | ||
| 541 | } | ||
| 542 | |||
| 543 | /* normal syntax */ | ||
| 544 | n = sscanf(arg, "%d.%d.%d:%d.%d", | ||
| 545 | &m->file_idx, &m->stream_idx, &m->channel_idx, | ||
| 546 | &m->ofile_idx, &m->ostream_idx); | ||
| 547 | |||
| 548 | if (n != 3 && n != 5) { | ||
| 549 | av_log(NULL, AV_LOG_FATAL, "Syntax error, mapchan usage: " | ||
| 550 | "[file.stream.channel|-1][:syncfile:syncstream]\n"); | ||
| 551 | goto fail; | ||
| 552 | } | ||
| 553 | |||
| 554 | if (n != 5) // only file.stream.channel specified | ||
| 555 | m->ofile_idx = m->ostream_idx = -1; | ||
| 556 | |||
| 557 | /* check input */ | ||
| 558 | if (m->file_idx < 0 || m->file_idx >= nb_input_files) { | ||
| 559 | av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file index: %d\n", | ||
| 560 | m->file_idx); | ||
| 561 | goto fail; | ||
| 562 | } | ||
| 563 | if (m->stream_idx < 0 || | ||
| 564 | m->stream_idx >= input_files[m->file_idx]->nb_streams) { | ||
| 565 | av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file stream index #%d.%d\n", | ||
| 566 | m->file_idx, m->stream_idx); | ||
| 567 | goto fail; | ||
| 568 | } | ||
| 569 | st = input_files[m->file_idx]->ctx->streams[m->stream_idx]; | ||
| 570 | if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) { | ||
| 571 | av_log(NULL, AV_LOG_FATAL, "mapchan: stream #%d.%d is not an audio stream.\n", | ||
| 572 | m->file_idx, m->stream_idx); | ||
| 573 | goto fail; | ||
| 574 | } | ||
| 575 | /* allow trailing ? to map_channel */ | ||
| 576 | if (allow_unused = strchr(mapchan, '?')) | ||
| 577 | *allow_unused = 0; | ||
| 578 | if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->ch_layout.nb_channels || | ||
| 579 | input_files[m->file_idx]->streams[m->stream_idx]->user_set_discard == AVDISCARD_ALL) { | ||
| 580 | if (allow_unused) { | ||
| 581 | av_log(NULL, AV_LOG_VERBOSE, "mapchan: invalid audio channel #%d.%d.%d\n", | ||
| 582 | m->file_idx, m->stream_idx, m->channel_idx); | ||
| 583 | } else { | ||
| 584 | av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n" | ||
| 585 | "To ignore this, add a trailing '?' to the map_channel.\n", | ||
| 586 | m->file_idx, m->stream_idx, m->channel_idx); | ||
| 587 | goto fail; | ||
| 588 | } | ||
| 589 | |||
| 590 | } | ||
| 591 | ret = 0; | ||
| 592 | end: | ||
| 593 | av_free(mapchan); | ||
| 594 | return ret; | ||
| 595 | fail: | ||
| 596 | ret = AVERROR(EINVAL); | ||
| 597 | goto end; | ||
| 598 | } | ||
| 599 | #endif | ||
| 600 | |||
| 601 | static int opt_sdp_file(void *optctx, const char *opt, const char *arg) | 489 | static int opt_sdp_file(void *optctx, const char *opt, const char *arg) |
| 602 | { | 490 | { |
| 603 | Scheduler *sch = optctx; | 491 | Scheduler *sch = optctx; |
| @@ -2005,21 +1893,11 @@ const OptionDef options[] = { · 1401 unmodified lines | |||
| 2005 | "set hardware device used when filtering", "device" }, | 1893 | "set hardware device used when filtering", "device" }, |
| 2006 | 1894 | ||
| 2007 | // deprecated options | 1895 | // deprecated options |
| 2008 | #if FFMPEG_OPT_MAP_CHANNEL | ||
| 2009 | { "map_channel", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, | ||
| 2010 | { .func_arg = opt_map_channel }, | ||
| 2011 | "map an audio channel from one stream to another (deprecated)", "file.stream.channel[:syncfile.syncstream]" }, | ||
| 2012 | #endif | ||
| 2013 | #if FFMPEG_OPT_ADRIFT_THRESHOLD | 1896 | #if FFMPEG_OPT_ADRIFT_THRESHOLD |
| 2014 | { "adrift_threshold", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, | 1897 | { "adrift_threshold", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, |
| 2015 | { .func_arg = opt_adrift_threshold }, | 1898 | { .func_arg = opt_adrift_threshold }, |
| 2016 | "deprecated, does nothing", "threshold" }, | 1899 | "deprecated, does nothing", "threshold" }, |
| 2017 | #endif | 1900 | #endif |
| 2018 | #if FFMPEG_OPT_PSNR | ||
| 2019 | { "psnr", OPT_TYPE_BOOL, OPT_VIDEO | OPT_EXPERT, | ||
| 2020 | { &do_psnr }, | ||
| 2021 | "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" }, | ||
| 2022 | #endif | ||
| 2023 | #if FFMPEG_OPT_TOP | 1901 | #if FFMPEG_OPT_TOP |
| 2024 | { "top", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT, | 1902 | { "top", OPT_TYPE_INT, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT | OPT_OUTPUT, |
| 2025 | { .off = OFFSET(top_field_first) }, | 1903 | { .off = OFFSET(top_field_first) }, |
| @@ -1,28 +1,3 @@ | |||
| 1 | FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV, MD5_PROTOCOL) += fate-mapchan-6ch-extract-2 | ||
| 2 | fate-mapchan-6ch-extract-2: tests/data/asynth-22050-6.wav | ||
| 3 | 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: | ||
| 4 | |||
| 5 | FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN ARESAMPLE, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-6ch-extract-2-downmix-mono | ||
| 6 | fate-mapchan-6ch-extract-2-downmix-mono: tests/data/asynth-22050-6.wav | ||
| 7 | 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 | ||
| 8 | |||
| 9 | FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-silent-mono | ||
| 10 | fate-mapchan-silent-mono: tests/data/asynth-22050-1.wav | ||
| 11 | 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 | ||
| 12 | |||
| 13 | FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-2ch-extract-ch0-ch2-trailing | ||
| 14 | fate-mapchan-2ch-extract-ch0-ch2-trailing: tests/data/asynth-44100-2.wav | ||
| 15 | 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 | ||
| 16 | |||
| 17 | FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-3ch-extract-ch0-ch2-trailing | ||
| 18 | fate-mapchan-3ch-extract-ch0-ch2-trailing: tests/data/asynth-44100-3.wav | ||
| 19 | 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 | ||
| 20 | |||
| 21 | FATE_MAPCHAN = $(FATE_MAPCHAN-yes) | ||
| 22 | |||
| 23 | FATE_FFMPEG += $(FATE_MAPCHAN) | ||
| 24 | fate-mapchan: $(FATE_MAPCHAN) | ||
| 25 | |||
| 26 | FATE_FFMPEG-$(call FILTERFRAMECRC, COLOR) += fate-ffmpeg-filter_complex | 1 | FATE_FFMPEG-$(call FILTERFRAMECRC, COLOR) += fate-ffmpeg-filter_complex |
| 27 | fate-ffmpeg-filter_complex: CMD = framecrc -filter_complex color=d=1:r=5 -fflags +bitexact | 2 | fate-ffmpeg-filter_complex: CMD = framecrc -filter_complex color=d=1:r=5 -fflags +bitexact |
| 28 | 3 | ||