static short *samples;
-static AVBitStreamFilterContext *video_bitstream_filters=NULL;
-static AVBitStreamFilterContext *audio_bitstream_filters=NULL;
-static AVBitStreamFilterContext *subtitle_bitstream_filters=NULL;
-
#define DEFAULT_PASS_LOGFILENAME_PREFIX "av2pass"
typedef struct InputStream {
int nb_metadata;
SpecifierOpt *max_frames;
int nb_max_frames;
+ SpecifierOpt *bitstream_filters;
+ int nb_bitstream_filters;
} OptionsContext;
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
AVStream *st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
int idx = oc->nb_streams - 1;
int64_t max_frames = INT64_MAX;
+ char *bsf = NULL, *next;
+ AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
if (!st) {
av_log(NULL, AV_LOG_ERROR, "Could not alloc stream.\n");
MATCH_PER_STREAM_OPT(max_frames, i64, max_frames, oc, st);
ost->max_frames = max_frames;
+ MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st);
+ while (bsf) {
+ if (next = strchr(bsf, ','))
+ *next++ = 0;
+ if (!(bsfc = av_bitstream_filter_init(bsf))) {
+ av_log(NULL, AV_LOG_ERROR, "Unknown bitstream filter %s\n", bsf);
+ exit_program(1);
+ }
+ if (bsfc_prev)
+ bsfc_prev->next = bsfc;
+ else
+ ost->bitstream_filters = bsfc;
+
+ bsfc_prev = bsfc;
+ bsf = next;
+ }
+
ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
return ost;
}
#endif
}
- ost->bitstream_filters = video_bitstream_filters;
- video_bitstream_filters= NULL;
-
video_enc = st->codec;
if(video_codec_tag)
ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO);
st = ost->st;
- ost->bitstream_filters = audio_bitstream_filters;
- audio_bitstream_filters= NULL;
-
audio_enc = st->codec;
audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
st = ost->st;
subtitle_enc = st->codec;
- ost->bitstream_filters = subtitle_bitstream_filters;
- subtitle_bitstream_filters= NULL;
-
subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
if(subtitle_codec_tag)
return opt_vstats_file(opt, filename);
}
-static int opt_bsf(const char *opt, const char *arg)
-{
- AVBitStreamFilterContext *bsfc= av_bitstream_filter_init(arg); //FIXME split name and args for filter at '='
- AVBitStreamFilterContext **bsfp;
-
- if(!bsfc){
- fprintf(stderr, "Unknown bitstream filter %s\n", arg);
- exit_program(1);
- }
-
- bsfp= *opt == 'v' ? &video_bitstream_filters :
- *opt == 'a' ? &audio_bitstream_filters :
- &subtitle_bitstream_filters;
- while(*bsfp)
- bsfp= &(*bsfp)->next;
-
- *bsfp= bsfc;
-
- return 0;
-}
-
static int opt_video_frames(OptionsContext *o, const char *opt, const char *arg)
{
return parse_option(o, "frames:v", arg, options);
{ "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_max_delay}, "set the maximum demux-decode delay", "seconds" },
{ "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_preload}, "set the initial demux-decode delay", "seconds" },
- { "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
- { "vbsf", HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
- { "sbsf", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
+ { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(bitstream_filters)}, "A comma-separated list of bitstream filters", "bitstream_filters" },
/* data codec support */
{ "dcodec", HAS_ARG | OPT_DATA | OPT_FUNC2, {(void*)opt_data_codec}, "force data codec ('copy' to copy stream)", "codec" },
Force video tag/fourcc.
@item -qphist
Show QP histogram.
-@item -vbsf @var{bitstream_filter}
-Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump", "mjpegadump", "mjpeg2jpeg".
-@example
-avconv -i h264.mp4 -c:v copy -vbsf h264_mp4toannexb -an out.h264
-@end example
@item -force_key_frames @var{time}[,@var{time}...]
Force key frames at the specified timestamps, more precisely at the first
frames after each specified time.
@item ka
Karaoke
@end table
-@item -absf @var{bitstream_filter}
-Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
@end table
@section Subtitle options:
Set the ISO 639 language code (3 letters) of the current subtitle stream.
@item -sn
Disable subtitle recording.
-@item -sbsf @var{bitstream_filter}
-Bitstream filters available are "mov2textsub", "text2movsub".
-@example
-avconv -i file.mov -an -vn -sbsf mov2textsub -c:s copy -f rawvideo sub.txt
-@end example
@end table
@section Audio/Video grab options
@example
avconv -i infile -streamid 0:33 -streamid 1:36 out.ts
@end example
+
+@item -bsf[:@var{stream_specifier}] @var{bitstream_filters}
+Set bitstream filters for matching streams. @var{bistream_filters} is
+a comma-separated list of bitstream filters. Use the @code{-bsfs} option
+to get the list of bitstream filters.
+@example
+avconv -i h264.mp4 -c:v copy -vbsf h264_mp4toannexb -an out.h264
+@end example
+@example
+avconv -i file.mov -an -vn -sbsf mov2textsub -c:s copy -f rawvideo sub.txt
+@end example
@end table
@c man end OPTIONS