]> git.sesse.net Git - ffmpeg/blob - doc/ffprobe.texi
2e9bfee29aa456cfec4a54926cd7db9181622a2f
[ffmpeg] / doc / ffprobe.texi
1 \input texinfo @c -*- texinfo -*-
2
3 @settitle ffprobe Documentation
4 @titlepage
5 @center @titlefont{ffprobe Documentation}
6 @end titlepage
7
8 @top
9
10 @contents
11
12 @chapter Synopsis
13
14 ffprobe [@var{options}] [@file{input_file}]
15
16 @chapter Description
17 @c man begin DESCRIPTION
18
19 ffprobe gathers information from multimedia streams and prints it in
20 human- and machine-readable fashion.
21
22 For example it can be used to check the format of the container used
23 by a multimedia stream and the format and type of each media stream
24 contained in it.
25
26 If a filename is specified in input, ffprobe will try to open and
27 probe the file content. If the file cannot be opened or recognized as
28 a multimedia file, a positive exit code is returned.
29
30 ffprobe may be employed both as a standalone application or in
31 combination with a textual filter, which may perform more
32 sophisticated processing, e.g. statistical processing or plotting.
33
34 Options are used to list some of the formats supported by ffprobe or
35 for specifying which information to display, and for setting how
36 ffprobe will show it.
37
38 ffprobe output is designed to be easily parsable by a textual filter,
39 and consists of one or more sections of a form defined by the selected
40 writer, which is specified by the @option{print_format} option.
41
42 Sections may contain other nested sections, and are identified by a
43 name (which may be shared by other sections), and an unique
44 name. See the output of @option{sections}.
45
46 Metadata tags stored in the container or in the streams are recognized
47 and printed in the corresponding "FORMAT", "STREAM" or "PROGRAM_STREAM"
48 section.
49
50 @c man end
51
52 @chapter Options
53 @c man begin OPTIONS
54
55 @include fftools-common-opts.texi
56
57 @section Main options
58
59 @table @option
60
61 @item -f @var{format}
62 Force format to use.
63
64 @item -unit
65 Show the unit of the displayed values.
66
67 @item -prefix
68 Use SI prefixes for the displayed values.
69 Unless the "-byte_binary_prefix" option is used all the prefixes
70 are decimal.
71
72 @item -byte_binary_prefix
73 Force the use of binary prefixes for byte values.
74
75 @item -sexagesimal
76 Use sexagesimal format HH:MM:SS.MICROSECONDS for time values.
77
78 @item -pretty
79 Prettify the format of the displayed values, it corresponds to the
80 options "-unit -prefix -byte_binary_prefix -sexagesimal".
81
82 @item -of, -print_format @var{writer_name}[=@var{writer_options}]
83 Set the output printing format.
84
85 @var{writer_name} specifies the name of the writer, and
86 @var{writer_options} specifies the options to be passed to the writer.
87
88 For example for printing the output in JSON format, specify:
89 @example
90 -print_format json
91 @end example
92
93 For more details on the available output printing formats, see the
94 Writers section below.
95
96 @item -sections
97 Print sections structure and section information, and exit. The output
98 is not meant to be parsed by a machine.
99
100 @item -select_streams @var{stream_specifier}
101 Select only the streams specified by @var{stream_specifier}. This
102 option affects only the options related to streams
103 (e.g. @code{show_streams}, @code{show_packets}, etc.).
104
105 For example to show only audio streams, you can use the command:
106 @example
107 ffprobe -show_streams -select_streams a INPUT
108 @end example
109
110 To show only video packets belonging to the video stream with index 1:
111 @example
112 ffprobe -show_packets -select_streams v:1 INPUT
113 @end example
114
115 @item -show_data
116 Show payload data, as a hexadecimal and ASCII dump. Coupled with
117 @option{-show_packets}, it will dump the packets' data. Coupled with
118 @option{-show_streams}, it will dump the codec extradata.
119
120 The dump is printed as the "data" field. It may contain newlines.
121
122 @item -show_error
123 Show information about the error found when trying to probe the input.
124
125 The error information is printed within a section with name "ERROR".
126
127 @item -show_format
128 Show information about the container format of the input multimedia
129 stream.
130
131 All the container format information is printed within a section with
132 name "FORMAT".
133
134 @item -show_format_entry @var{name}
135 Like @option{-show_format}, but only prints the specified entry of the
136 container format information, rather than all. This option may be given more
137 than once, then all specified entries will be shown.
138
139 This option is deprecated, use @code{show_entries} instead.
140
141 @item -show_entries @var{section_entries}
142 Set list of entries to show.
143
144 Entries are specified according to the following
145 syntax. @var{section_entries} contains a list of section entries
146 separated by @code{:}. Each section entry is composed by a section
147 name (or unique name), optionally followed by a list of entries local
148 to that section, separated by @code{,}.
149
150 If section name is specified but is followed by no @code{=}, all
151 entries are printed to output, together with all the contained
152 sections. Otherwise only the entries specified in the local section
153 entries list are printed. In particular, if @code{=} is specified but
154 the list of local entries is empty, then no entries will be shown for
155 that section.
156
157 Note that the order of specification of the local section entries is
158 not honored in the output, and the usual display order will be
159 retained.
160
161 The formal syntax is given by:
162 @example
163 @var{LOCAL_SECTION_ENTRIES} ::= @var{SECTION_ENTRY_NAME}[,@var{LOCAL_SECTION_ENTRIES}]
164 @var{SECTION_ENTRY}         ::= @var{SECTION_NAME}[=[@var{LOCAL_SECTION_ENTRIES}]]
165 @var{SECTION_ENTRIES}       ::= @var{SECTION_ENTRY}[:@var{SECTION_ENTRIES}]
166 @end example
167
168 For example, to show only the index and type of each stream, and the PTS
169 time, duration time, and stream index of the packets, you can specify
170 the argument:
171 @example
172 packet=pts_time,duration_time,stream_index : stream=index,codec_type
173 @end example
174
175 To show all the entries in the section "format", but only the codec
176 type in the section "stream", specify the argument:
177 @example
178 format : stream=codec_type
179 @end example
180
181 To show all the tags in the stream and format sections:
182 @example
183 format_tags : format_tags
184 @end example
185
186 To show only the @code{title} tag (if available) in the stream
187 sections:
188 @example
189 stream_tags=title
190 @end example
191
192 @item -show_packets
193 Show information about each packet contained in the input multimedia
194 stream.
195
196 The information for each single packet is printed within a dedicated
197 section with name "PACKET".
198
199 @item -show_frames
200 Show information about each frame contained in the input multimedia
201 stream.
202
203 The information for each single frame is printed within a dedicated
204 section with name "FRAME".
205
206 @item -show_streams
207 Show information about each media stream contained in the input
208 multimedia stream.
209
210 Each media stream information is printed within a dedicated section
211 with name "STREAM".
212
213 @item -show_programs
214 Show information about programs and their streams contained in the input
215 multimedia stream.
216
217 Each media stream information is printed within a dedicated section
218 with name "PROGRAM_STREAM".
219
220 @item -show_chapters
221 Show information about chapters stored in the format.
222
223 Each chapter is printed within a dedicated section with name "CHAPTER".
224
225 @item -count_frames
226 Count the number of frames per stream and report it in the
227 corresponding stream section.
228
229 @item -count_packets
230 Count the number of packets per stream and report it in the
231 corresponding stream section.
232
233 @item -read_intervals @var{read_intervals}
234
235 Read only the specified intervals. @var{read_intervals} must be a
236 sequence of interval specifications separated by ",".
237 @command{ffprobe} will seek to the interval starting point, and will
238 continue reading from that.
239
240 Each interval is specified by two optional parts, separated by "%".
241
242 The first part specifies the interval start position. It is
243 interpreted as an abolute position, or as a relative offset from the
244 current position if it is preceded by the "+" character. If this first
245 part is not specified, no seeking will be performed when reading this
246 interval.
247
248 The second part specifies the interval end position. It is interpreted
249 as an absolute position, or as a relative offset from the current
250 position if it is preceded by the "+" character. If the offset
251 specification starts with "#", it is interpreted as the number of
252 packets to read (not including the flushing packets) from the interval
253 start. If no second part is specified, the program will read until the
254 end of the input.
255
256 Note that seeking is not accurate, thus the actual interval start
257 point may be different from the specified position. Also, when an
258 interval duration is specified, the absolute end time will be computed
259 by adding the duration to the interval start point found by seeking
260 the file, rather than to the specified start value.
261
262 The formal syntax is given by:
263 @example
264 @var{INTERVAL}  ::= [@var{START}|+@var{START_OFFSET}][%[@var{END}|+@var{END_OFFSET}]]
265 @var{INTERVALS} ::= @var{INTERVAL}[,@var{INTERVALS}]
266 @end example
267
268 A few examples follow.
269 @itemize
270 @item
271 Seek to time 10, read packets until 20 seconds after the found seek
272 point, then seek to position @code{01:30} (1 minute and thirty
273 seconds) and read packets until position @code{01:45}.
274 @example
275 10%+20,01:30%01:45
276 @end example
277
278 @item
279 Read only 42 packets after seeking to position @code{01:23}:
280 @example
281 01:23%+#42
282 @end example
283
284 @item
285 Read only the first 20 seconds from the start:
286 @example
287 %+20
288 @end example
289
290 @item
291 Read from the start until position @code{02:30}:
292 @example
293 %02:30
294 @end example
295 @end itemize
296
297 @item -show_private_data, -private
298 Show private data, that is data depending on the format of the
299 particular shown element.
300 This option is enabled by default, but you may need to disable it
301 for specific uses, for example when creating XSD-compliant XML output.
302
303 @item -show_program_version
304 Show information related to program version.
305
306 Version information is printed within a section with name
307 "PROGRAM_VERSION".
308
309 @item -show_library_versions
310 Show information related to library versions.
311
312 Version information for each library is printed within a section with
313 name "LIBRARY_VERSION".
314
315 @item -show_versions
316 Show information related to program and library versions. This is the
317 equivalent of setting both @option{-show_program_version} and
318 @option{-show_library_versions} options.
319
320 @item -bitexact
321 Force bitexact output, useful to produce output which is not dependent
322 on the specific build.
323
324 @item -i @var{input_file}
325 Read @var{input_file}.
326
327 @end table
328 @c man end
329
330 @chapter Writers
331 @c man begin WRITERS
332
333 A writer defines the output format adopted by @command{ffprobe}, and will be
334 used for printing all the parts of the output.
335
336 A writer may accept one or more arguments, which specify the options
337 to adopt. The options are specified as a list of @var{key}=@var{value}
338 pairs, separated by ":".
339
340 All writers support the following options:
341
342 @table @option
343 @item string_validation, sv
344 Set string validation mode.
345
346 The following values are accepted.
347 @table @samp
348 @item fail
349 The writer will fail immediately in case an invalid string (UTF-8)
350 sequence or code point is found in the input. This is especially
351 useful to validate input metadata.
352
353 @item ignore
354 Any validation error will be ignored. This will result in possibly
355 broken output, especially with the json or xml writer.
356
357 @item replace
358 The writer will substitute invalid UTF-8 sequences or code points with
359 the string specified with the @option{string_validation_replacement}.
360 @end table
361
362 Default value is @samp{replace}.
363
364 @item string_validation_replacement, svr
365 Set replacement string to use in case @option{string_validation} is
366 set to @samp{replace}.
367
368 In case the option is not specified, the writer will assume the empty
369 string, that is it will remove the invalid sequences from the input
370 strings.
371 @end table
372
373 A description of the currently available writers follows.
374
375 @section default
376 Default format.
377
378 Print each section in the form:
379 @example
380 [SECTION]
381 key1=val1
382 ...
383 keyN=valN
384 [/SECTION]
385 @end example
386
387 Metadata tags are printed as a line in the corresponding FORMAT, STREAM or
388 PROGRAM_STREAM section, and are prefixed by the string "TAG:".
389
390 A description of the accepted options follows.
391
392 @table @option
393
394 @item nokey, nk
395 If set to 1 specify not to print the key of each field. Default value
396 is 0.
397
398 @item noprint_wrappers, nw
399 If set to 1 specify not to print the section header and footer.
400 Default value is 0.
401 @end table
402
403 @section compact, csv
404 Compact and CSV format.
405
406 The @code{csv} writer is equivalent to @code{compact}, but supports
407 different defaults.
408
409 Each section is printed on a single line.
410 If no option is specifid, the output has the form:
411 @example
412 section|key1=val1| ... |keyN=valN
413 @end example
414
415 Metadata tags are printed in the corresponding "format" or "stream"
416 section. A metadata tag key, if printed, is prefixed by the string
417 "tag:".
418
419 The description of the accepted options follows.
420
421 @table @option
422
423 @item item_sep, s
424 Specify the character to use for separating fields in the output line.
425 It must be a single printable character, it is "|" by default ("," for
426 the @code{csv} writer).
427
428 @item nokey, nk
429 If set to 1 specify not to print the key of each field. Its default
430 value is 0 (1 for the @code{csv} writer).
431
432 @item escape, e
433 Set the escape mode to use, default to "c" ("csv" for the @code{csv}
434 writer).
435
436 It can assume one of the following values:
437 @table @option
438 @item c
439 Perform C-like escaping. Strings containing a newline ('\n'), carriage
440 return ('\r'), a tab ('\t'), a form feed ('\f'), the escaping
441 character ('\') or the item separator character @var{SEP} are escaped using C-like fashioned
442 escaping, so that a newline is converted to the sequence "\n", a
443 carriage return to "\r", '\' to "\\" and the separator @var{SEP} is
444 converted to "\@var{SEP}".
445
446 @item csv
447 Perform CSV-like escaping, as described in RFC4180.  Strings
448 containing a newline ('\n'), a carriage return ('\r'), a double quote
449 ('"'), or @var{SEP} are enclosed in double-quotes.
450
451 @item none
452 Perform no escaping.
453 @end table
454
455 @item print_section, p
456 Print the section name at the begin of each line if the value is
457 @code{1}, disable it with value set to @code{0}. Default value is
458 @code{1}.
459
460 @end table
461
462 @section flat
463 Flat format.
464
465 A free-form output where each line contains an explicit key=value, such as
466 "streams.stream.3.tags.foo=bar". The output is shell escaped, so it can be
467 directly embedded in sh scripts as long as the separator character is an
468 alphanumeric character or an underscore (see @var{sep_char} option).
469
470 The description of the accepted options follows.
471
472 @table @option
473 @item sep_char, s
474 Separator character used to separate the chapter, the section name, IDs and
475 potential tags in the printed field key.
476
477 Default value is '.'.
478
479 @item hierarchical, h
480 Specify if the section name specification should be hierarchical. If
481 set to 1, and if there is more than one section in the current
482 chapter, the section name will be prefixed by the name of the
483 chapter. A value of 0 will disable this behavior.
484
485 Default value is 1.
486 @end table
487
488 @section ini
489 INI format output.
490
491 Print output in an INI based format.
492
493 The following conventions are adopted:
494
495 @itemize
496 @item
497 all key and values are UTF-8
498 @item
499 '.' is the subgroup separator
500 @item
501 newline, '\t', '\f', '\b' and the following characters are escaped
502 @item
503 '\' is the escape character
504 @item
505 '#' is the comment indicator
506 @item
507 '=' is the key/value separator
508 @item
509 ':' is not used but usually parsed as key/value separator
510 @end itemize
511
512 This writer accepts options as a list of @var{key}=@var{value} pairs,
513 separated by ":".
514
515 The description of the accepted options follows.
516
517 @table @option
518 @item hierarchical, h
519 Specify if the section name specification should be hierarchical. If
520 set to 1, and if there is more than one section in the current
521 chapter, the section name will be prefixed by the name of the
522 chapter. A value of 0 will disable this behavior.
523
524 Default value is 1.
525 @end table
526
527 @section json
528 JSON based format.
529
530 Each section is printed using JSON notation.
531
532 The description of the accepted options follows.
533
534 @table @option
535
536 @item compact, c
537 If set to 1 enable compact output, that is each section will be
538 printed on a single line. Default value is 0.
539 @end table
540
541 For more information about JSON, see @url{http://www.json.org/}.
542
543 @section xml
544 XML based format.
545
546 The XML output is described in the XML schema description file
547 @file{ffprobe.xsd} installed in the FFmpeg datadir.
548
549 An updated version of the schema can be retrieved at the url
550 @url{http://www.ffmpeg.org/schema/ffprobe.xsd}, which redirects to the
551 latest schema committed into the FFmpeg development source code tree.
552
553 Note that the output issued will be compliant to the
554 @file{ffprobe.xsd} schema only when no special global output options
555 (@option{unit}, @option{prefix}, @option{byte_binary_prefix},
556 @option{sexagesimal} etc.) are specified.
557
558 The description of the accepted options follows.
559
560 @table @option
561
562 @item fully_qualified, q
563 If set to 1 specify if the output should be fully qualified. Default
564 value is 0.
565 This is required for generating an XML file which can be validated
566 through an XSD file.
567
568 @item xsd_compliant, x
569 If set to 1 perform more checks for ensuring that the output is XSD
570 compliant. Default value is 0.
571 This option automatically sets @option{fully_qualified} to 1.
572 @end table
573
574 For more information about the XML format, see
575 @url{http://www.w3.org/XML/}.
576 @c man end WRITERS
577
578 @chapter Timecode
579 @c man begin TIMECODE
580
581 @command{ffprobe} supports Timecode extraction:
582
583 @itemize
584
585 @item
586 MPEG1/2 timecode is extracted from the GOP, and is available in the video
587 stream details (@option{-show_streams}, see @var{timecode}).
588
589 @item
590 MOV timecode is extracted from tmcd track, so is available in the tmcd
591 stream metadata (@option{-show_streams}, see @var{TAG:timecode}).
592
593 @item
594 DV, GXF and AVI timecodes are available in format metadata
595 (@option{-show_format}, see @var{TAG:timecode}).
596
597 @end itemize
598 @c man end TIMECODE
599
600 @include config.texi
601 @ifset config-all
602 @ifset config-avutil
603 @include utils.texi
604 @end ifset
605 @ifset config-avcodec
606 @include codecs.texi
607 @include bitstream_filters.texi
608 @end ifset
609 @ifset config-avformat
610 @include formats.texi
611 @include protocols.texi
612 @end ifset
613 @ifset config-avdevice
614 @include devices.texi
615 @end ifset
616 @ifset config-swresample
617 @include resampler.texi
618 @end ifset
619 @ifset config-swscale
620 @include scaler.texi
621 @end ifset
622 @ifset config-avfilter
623 @include filters.texi
624 @end ifset
625 @end ifset
626
627 @chapter See Also
628
629 @ifhtml
630 @ifset config-all
631 @url{ffprobe.html,ffprobe},
632 @end ifset
633 @ifset config-not-all
634 @url{ffprobe-all.html,ffprobe-all},
635 @end ifset
636 @url{ffmpeg.html,ffmpeg}, @url{ffplay.html,ffplay}, @url{ffserver.html,ffserver},
637 @url{ffmpeg-utils.html,ffmpeg-utils},
638 @url{ffmpeg-scaler.html,ffmpeg-scaler},
639 @url{ffmpeg-resampler.html,ffmpeg-resampler},
640 @url{ffmpeg-codecs.html,ffmpeg-codecs},
641 @url{ffmpeg-bitstream-filters.html,ffmpeg-bitstream-filters},
642 @url{ffmpeg-formats.html,ffmpeg-formats},
643 @url{ffmpeg-devices.html,ffmpeg-devices},
644 @url{ffmpeg-protocols.html,ffmpeg-protocols},
645 @url{ffmpeg-filters.html,ffmpeg-filters}
646 @end ifhtml
647
648 @ifnothtml
649 @ifset config-all
650 ffprobe(1),
651 @end ifset
652 @ifset config-not-all
653 ffprobe-all(1),
654 @end ifset
655 ffmpeg(1), ffplay(1), ffserver(1),
656 ffmpeg-utils(1), ffmpeg-scaler(1), ffmpeg-resampler(1),
657 ffmpeg-codecs(1), ffmpeg-bitstream-filters(1), ffmpeg-formats(1),
658 ffmpeg-devices(1), ffmpeg-protocols(1), ffmpeg-filters(1)
659 @end ifnothtml
660
661 @include authors.texi
662
663 @ignore
664
665 @setfilename ffprobe
666 @settitle ffprobe media prober
667
668 @end ignore
669
670 @bye