[FFmpeg-devel,2/2] cmdutils: add show_help_protocol for get protocol options

Submitted by Steven Liu on Nov. 22, 2019, 8:56 a.m.

Details

Message ID 20191122085639.14340-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu Nov. 22, 2019, 8:56 a.m.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 fftools/cmdutils.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Gyan Nov. 22, 2019, 9:30 a.m.
On 22-11-2019 02:26 pm, Steven Liu wrote:
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>   fftools/cmdutils.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
>
> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
> index 84f98b7c04..fe18093ce1 100644
> --- a/fftools/cmdutils.c
> +++ b/fftools/cmdutils.c
> @@ -1870,6 +1870,21 @@ static void show_help_demuxer(const char *name)
>           show_help_children(fmt->priv_class, AV_OPT_FLAG_DECODING_PARAM);
>   }
>   
> +static void show_help_protocol(const char *name)
> +{
> +    const URLProtocol *proto = av_find_protocol_by_name(name);;
> +
> +    if (!proto) {
> +        av_log(NULL, AV_LOG_ERROR, "Unknown protocol '%s'.\n", name);
> +        return;
> +    }
> +
> +    printf("Protocol %s:\n", name);
> +
> +    if (proto->priv_data_class)
> +        show_help_children(proto->priv_data_class, AV_OPT_FLAG_DECODING_PARAM);
> +}

Protocols may be employed for output as well. Is there a separate option 
for those protocol options?

> +
>   static void show_help_muxer(const char *name)
>   {
>       const AVCodecDescriptor *desc;
> @@ -2000,6 +2015,8 @@ int show_help(void *optctx, const char *opt, const char *arg)
>           show_help_demuxer(par);
>       } else if (!strcmp(topic, "muxer")) {
>           show_help_muxer(par);
> +    } else if (!strcmp(topic, "protocol")) {
> +        show_help_protocol(par);
>   #if CONFIG_AVFILTER
>       } else if (!strcmp(topic, "filter")) {
>           show_help_filter(par);

Regards,
Gyan
Steven Liu Nov. 22, 2019, 9:38 a.m.
> 在 2019年11月22日,17:30,Gyan <ffmpeg@gyani.pro> 写道:
> 
> 
> 
> On 22-11-2019 02:26 pm, Steven Liu wrote:
>> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>> ---
>>  fftools/cmdutils.c | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
>> 
>> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
>> index 84f98b7c04..fe18093ce1 100644
>> --- a/fftools/cmdutils.c
>> +++ b/fftools/cmdutils.c
>> @@ -1870,6 +1870,21 @@ static void show_help_demuxer(const char *name)
>>          show_help_children(fmt->priv_class, AV_OPT_FLAG_DECODING_PARAM);
>>  }
>>  +static void show_help_protocol(const char *name)
>> +{
>> +    const URLProtocol *proto = av_find_protocol_by_name(name);;
>> +
>> +    if (!proto) {
>> +        av_log(NULL, AV_LOG_ERROR, "Unknown protocol '%s'.\n", name);
>> +        return;
>> +    }
>> +
>> +    printf("Protocol %s:\n", name);
>> +
>> +    if (proto->priv_data_class)
>> +        show_help_children(proto->priv_data_class, AV_OPT_FLAG_DECODING_PARAM);
>> +}
> 
> Protocols may be employed for output as well. Is there a separate option for those protocol options?

after patch:

liuqideMBP:dash liuqi$ ./ffmpeg -h protocol=rtmp
ffmpeg version N-95813-g5353723f20 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libspeex --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-version3 --enable-nonfree --enable-videotoolbox --enable-libxml2 --samples=fate-suite/ --enable-libopencv --enable-libopus
  libavutil      56. 36.100 / 56. 36.100
  libavcodec     58. 62.100 / 58. 62.100
  libavformat    58. 35.101 / 58. 35.101
  libavdevice    58.  9.101 / 58.  9.101
  libavfilter     7. 66.100 /  7. 66.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Protocol rtmp:
rtmp AVOptions:
  -rtmp_app          <string>     ED........ Name of application to connect to on the RTMP server
  -rtmp_buffer       <int>        ED........ Set buffer time in milliseconds. The default is 3000. (from 0 to INT_MAX) (default 3000)
  -rtmp_conn         <string>     ED........ Append arbitrary AMF data to the Connect message
  -rtmp_flashver     <string>     ED........ Version of the Flash plugin used to run the SWF player.
  -rtmp_live         <int>        .D........ Specify that the media is a live stream. (from INT_MIN to INT_MAX) (default any)
     any             -2           .D........ both
     live            -1           .D........ live stream
     recorded        0            .D........ recorded stream
  -rtmp_pageurl      <string>     .D........ URL of the web page in which the media was embedded. By default no value will be sent.
  -rtmp_playpath     <string>     ED........ Stream identifier to play or to publish
  -rtmp_subscribe    <string>     .D........ Name of live stream to subscribe to. Defaults to rtmp_playpath.
  -rtmp_swfhash      <binary>     .D........ SHA256 hash of the decompressed SWF file (32 bytes).
  -rtmp_swfsize      <int>        .D........ Size of the decompressed SWF file, required for SWFVerification. (from 0 to INT_MAX) (default 0)
  -rtmp_swfurl       <string>     ED........ URL of the SWF player. By default no value will be sent
  -rtmp_swfverify    <string>     .D........ URL to player swf file, compute hash/size automatically.
  -rtmp_tcurl        <string>     ED........ URL of the target stream. Defaults to proto://host[:port]/app.
  -rtmp_listen       <int>        .D........ Listen for incoming rtmp connections (from INT_MIN to INT_MAX) (default 0)
  -listen            <int>        .D........ Listen for incoming rtmp connections (from INT_MIN to INT_MAX) (default 0)
  -timeout           <int>        .D........ Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies -rtmp_listen 1 (from INT_MIN to INT_MAX) (default -1)


before patch:

liuqideMBP:dash liuqi$
liuqideMBP:dash liuqi$
liuqideMBP:dash liuqi$ ffmpeg -h protocol=rtmp
ffmpeg version N-95812-gd73f062706 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libspeex --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-version3 --enable-nonfree --enable-videotoolbox --enable-libxml2 --samples=fate-suite/ --enable-libopencv
  libavutil      56. 36.100 / 56. 36.100
  libavcodec     58. 62.100 / 58. 62.100
  libavformat    58. 35.100 / 58. 35.100
  libavdevice    58.  9.101 / 58.  9.101
  libavfilter     7. 66.100 /  7. 66.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Unknown help option 'protocol'.
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Getting help:
    -h      -- print basic options
    -h long -- print more options
    -h full -- print all options (including all format and codec specific options, very long)
    -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf
    See man ffmpeg for detailed description of the options.

Print help / information / capabilities:
-L                  show license
-h topic            show help
-? topic            show help
-help topic         show help
--help topic        show help
-version            show version
-buildconf          show build configuration
-formats            show available formats
-muxers             show available muxers
-demuxers           show available demuxers
-devices            show available devices
-codecs             show available codecs
-decoders           show available decoders
-encoders           show available encoders
-bsfs               show available bit stream filters
-protocols          show available protocols
-filters            show available filters
-pix_fmts           show available pixel formats
-layouts            show standard channel layouts
-sample_fmts        show available audio sample formats
-colors             show available color names
-sources device     list sources of the input device
-sinks device       list sinks of the output device
-hwaccels           show available HW acceleration methods

Global options (affect whole program instead of just one file:
-loglevel loglevel  set logging level
-v loglevel         set logging level
-report             generate a report
-max_alloc bytes    set maximum size of a single allocated block
-y                  overwrite output files
-n                  never overwrite output files
-ignore_unknown     Ignore unknown stream types
-filter_threads     number of non-complex filter threads
-filter_complex_threads  number of threads for -filter_complex
-stats              print progress report during encoding
-max_error_rate maximum error rate  ratio of errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.
-bits_per_raw_sample number  set the number of bits per raw sample
-vol volume         change audio volume (256=normal)

Per-file main options:
-f fmt              force format
-c codec            codec name
-codec codec        codec name
-pre preset         preset name
-map_metadata outfile[,metadata]:infile[,metadata]  set metadata information of outfile from infile
-t duration         record or transcode "duration" seconds of audio/video
-to time_stop       record or transcode stop time
-fs limit_size      set the limit file size in bytes
-ss time_off        set the start time offset
-sseof time_off     set the start time offset relative to EOF
-seek_timestamp     enable/disable seeking by timestamp with -ss
-timestamp time     set the recording timestamp ('now' to set the current time)
-metadata string=string  add metadata
-program title=string:st=number...  add program with specified streams
-target type        specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50" with optional prefixes "pal-", "ntsc-" or "film-")
-apad               audio pad
-frames number      set the number of frames to output
-filter filter_graph  set stream filtergraph
-filter_script filename  read stream filtergraph description from a file
-reinit_filter      reinit filtergraph on input parameter changes
-discard            discard
-disposition        disposition

Video options:
-vframes number     set the number of video frames to output
-r rate             set frame rate (Hz value, fraction or abbreviation)
-s size             set frame size (WxH or abbreviation)
-aspect aspect      set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-bits_per_raw_sample number  set the number of bits per raw sample
-vn                 disable video
-vcodec codec       force video codec ('copy' to copy stream)
-timecode hh:mm:ss[:;.]ff  set initial TimeCode value.
-pass n             select the pass number (1 to 3)
-vf filter_graph    set video filters
-ab bitrate         audio bitrate (please use -b:a)
-b bitrate          video bitrate (please use -b:v)
-dn                 disable data

Audio options:
-aframes number     set the number of audio frames to output
-aq quality         set audio quality (codec-specific)
-ar rate            set audio sampling rate (in Hz)
-ac channels        set number of audio channels
-an                 disable audio
-acodec codec       force audio codec ('copy' to copy stream)
-vol volume         change audio volume (256=normal)
-af filter_graph    set audio filters

Subtitle options:
-s size             set frame size (WxH or abbreviation)
-sn                 disable subtitle
-scodec codec       force subtitle codec ('copy' to copy stream)
-stag fourcc/tag    force subtitle tag/fourcc
-fix_sub_duration   fix subtitles duration
-canvas_size size   set canvas size (WxH or abbreviation)
-spre preset        set the subtitle options to the indicated preset


liuqideMBP:dash liuqi$
> 
>> +
>>  static void show_help_muxer(const char *name)
>>  {
>>      const AVCodecDescriptor *desc;
>> @@ -2000,6 +2015,8 @@ int show_help(void *optctx, const char *opt, const char *arg)
>>          show_help_demuxer(par);
>>      } else if (!strcmp(topic, "muxer")) {
>>          show_help_muxer(par);
>> +    } else if (!strcmp(topic, "protocol")) {
>> +        show_help_protocol(par);
>>  #if CONFIG_AVFILTER
>>      } else if (!strcmp(topic, "filter")) {
>>          show_help_filter(par);
> 
> Regards,
> Gyan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Thanks
Steven
Gyan Nov. 22, 2019, 9:47 a.m.
On 22-11-2019 03:08 pm, Steven Liu wrote:
>
>> 在 2019年11月22日,17:30,Gyan <ffmpeg@gyani.pro> 写道:
>>
>>
>>
>> On 22-11-2019 02:26 pm, Steven Liu wrote:
>>> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>>> ---
>>>   fftools/cmdutils.c | 17 +++++++++++++++++
>>>   1 file changed, 17 insertions(+)
>>>
>>> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
>>> index 84f98b7c04..fe18093ce1 100644
>>> --- a/fftools/cmdutils.c
>>> +++ b/fftools/cmdutils.c
>>> @@ -1870,6 +1870,21 @@ static void show_help_demuxer(const char *name)
>>>           show_help_children(fmt->priv_class, AV_OPT_FLAG_DECODING_PARAM);
>>>   }
>>>   +static void show_help_protocol(const char *name)
>>> +{
>>> +    const URLProtocol *proto = av_find_protocol_by_name(name);;
>>> +
>>> +    if (!proto) {
>>> +        av_log(NULL, AV_LOG_ERROR, "Unknown protocol '%s'.\n", name);
>>> +        return;
>>> +    }
>>> +
>>> +    printf("Protocol %s:\n", name);
>>> +
>>> +    if (proto->priv_data_class)
>>> +        show_help_children(proto->priv_data_class, AV_OPT_FLAG_DECODING_PARAM);
>>> +}
>> Protocols may be employed for output as well. Is there a separate option for those protocol options?
> after patch:
>
> liuqideMBP:dash liuqi$ ./ffmpeg -h protocol=rtmp
> ffmpeg version N-95813-g5353723f20 Copyright (c) 2000-2019 the FFmpeg developers
>    built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
>    configuration: --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libspeex --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-version3 --enable-nonfree --enable-videotoolbox --enable-libxml2 --samples=fate-suite/ --enable-libopencv --enable-libopus
>    libavutil      56. 36.100 / 56. 36.100
>    libavcodec     58. 62.100 / 58. 62.100
>    libavformat    58. 35.101 / 58. 35.101
>    libavdevice    58.  9.101 / 58.  9.101
>    libavfilter     7. 66.100 /  7. 66.100
>    libswscale      5.  6.100 /  5.  6.100
>    libswresample   3.  6.100 /  3.  6.100
>    libpostproc    55.  6.100 / 55.  6.100
> Protocol rtmp:
> rtmp AVOptions:
>    -rtmp_app          <string>     ED........ Name of application to connect to on the RTMP server
>    -rtmp_buffer       <int>        ED........ Set buffer time in milliseconds. The default is 3000. (from 0 to INT_MAX) (default 3000)
>    -rtmp_conn         <string>     ED........ Append arbitrary AMF data to the Connect message
>    -rtmp_flashver     <string>     ED........ Version of the Flash plugin used to run the SWF player.
>    -rtmp_live         <int>        .D........ Specify that the media is a live stream. (from INT_MIN to INT_MAX) (default any)
>       any             -2           .D........ both
>       live            -1           .D........ live stream
>       recorded        0            .D........ recorded stream
>    -rtmp_pageurl      <string>     .D........ URL of the web page in which the media was embedded. By default no value will be sent.
>    -rtmp_playpath     <string>     ED........ Stream identifier to play or to publish
>    -rtmp_subscribe    <string>     .D........ Name of live stream to subscribe to. Defaults to rtmp_playpath.
>    -rtmp_swfhash      <binary>     .D........ SHA256 hash of the decompressed SWF file (32 bytes).
>    -rtmp_swfsize      <int>        .D........ Size of the decompressed SWF file, required for SWFVerification. (from 0 to INT_MAX) (default 0)
>    -rtmp_swfurl       <string>     ED........ URL of the SWF player. By default no value will be sent
>    -rtmp_swfverify    <string>     .D........ URL to player swf file, compute hash/size automatically.
>    -rtmp_tcurl        <string>     ED........ URL of the target stream. Defaults to proto://host[:port]/app.
>    -rtmp_listen       <int>        .D........ Listen for incoming rtmp connections (from INT_MIN to INT_MAX) (default 0)
>    -listen            <int>        .D........ Listen for incoming rtmp connections (from INT_MIN to INT_MAX) (default 0)
>    -timeout           <int>        .D........ Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies -rtmp_listen 1 (from INT_MIN to INT_MAX) (default -1)

-rtmp_flush_interval is missing since it's an output only option. Which 
command shows that field?

Gyan
Steven Liu Nov. 22, 2019, 10:01 a.m.
> 在 2019年11月22日,17:47,Gyan <ffmpeg@gyani.pro> 写道:
> 
> -rtmp_flush_interval is missing since it's an output only option. Which command shows that field?

Ah get your point, thanks.

New patch will come.

Thanks
Steven

Patch hide | download patch | download mbox

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 84f98b7c04..fe18093ce1 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1870,6 +1870,21 @@  static void show_help_demuxer(const char *name)
         show_help_children(fmt->priv_class, AV_OPT_FLAG_DECODING_PARAM);
 }
 
+static void show_help_protocol(const char *name)
+{
+    const URLProtocol *proto = av_find_protocol_by_name(name);;
+
+    if (!proto) {
+        av_log(NULL, AV_LOG_ERROR, "Unknown protocol '%s'.\n", name);
+        return;
+    }
+
+    printf("Protocol %s:\n", name);
+
+    if (proto->priv_data_class)
+        show_help_children(proto->priv_data_class, AV_OPT_FLAG_DECODING_PARAM);
+}
+
 static void show_help_muxer(const char *name)
 {
     const AVCodecDescriptor *desc;
@@ -2000,6 +2015,8 @@  int show_help(void *optctx, const char *opt, const char *arg)
         show_help_demuxer(par);
     } else if (!strcmp(topic, "muxer")) {
         show_help_muxer(par);
+    } else if (!strcmp(topic, "protocol")) {
+        show_help_protocol(par);
 #if CONFIG_AVFILTER
     } else if (!strcmp(topic, "filter")) {
         show_help_filter(par);