Opened 12 years ago

Closed 12 years ago

#909 closed defect (invalid)

FFProbe Print_Format Improper Formatting

Reported by: Chris Owned by: stefano
Priority: normal Component: ffprobe
Version: 0.9.1 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

When using ffprobe, using the XML option for print_format, character encoding on values does not take place which creates invalid XML which can't be parsed.

The JSON option will render proper encoding to protect JavaScript run-time by adding an additional backslash when one is present such as in media path/filename. Example: "D:\movie.mp4" appears in JSON output as "D:\ \move.mp4". No special handling takes place with XML.

In all formats (default, XML, JSON) using the show_streams option, the Bit_Rate for both audio and video are omitted. This information is present in the standard metadata/duration/stream sections in the console output.

Thank you for the consideration of this bug submission.

Chris

ffprobe -i "D:\admin\ffmpeg\stv.flv" -show_streams -print_format json
ffprobe version N-36492-g7f83db3, Copyright (c) 2007-2012 the FFmpeg developers

built on Jan 5 2012 01:59:46 with gcc 4.6.2
configuration: --disable-static --enable-shared --enable-gpl --enable-version3

--disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzli

b --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable
-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-l
ibrtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-li
bvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-l
ibx264 --enable-libxavs --enable-libxvid --enable-zlib

libavutil 51. 34.100 / 51. 34.100
libavcodec 53. 53.100 / 53. 53.100
libavformat 53. 29.100 / 53. 29.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 57.101 / 2. 57.101
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 5.100 / 0. 5.100
libpostproc 51. 2.100 / 51. 2.100

Change History (1)

in reply to:  description comment:1 by Stefano Sabatini, 12 years ago

Analyzed by developer: set
Reproduced by developer: set
Resolution: invalid
Status: newclosed

Replying to ChrisAtlGA:

When using ffprobe, using the XML option for print_format, character encoding on values does not take place which creates invalid XML which can't be parsed.

The JSON option will render proper encoding to protect JavaScript run-time by adding an additional backslash when one is present such as in media path/filename. Example: "D:\movie.mp4" appears in JSON output as "D:\ \move.mp4". No special handling takes place with XML.

XML doesn't require '\' escaping like in JSON, check function xml_escape_str() in ffprobe.c, but you may need a function to perform XML-de-escaping for parsing the resulting output (which will be different from a JSON de-escaping function).

In all formats (default, XML, JSON) using the show_streams option, the Bit_Rate for both audio and video are omitted. This information is present in the standard metadata/duration/stream sections in the console output.

Yes this is intentional, when the bit_rate (or other) information is not available, it is preferable not to show it in the output, so that application code doesn't need to interpret the assumed string value for "undefined". This is different in case of output formats which *require* a constant number of fields per each section (compact, default).

Thank you for the consideration of this bug submission.

Closing the ticket as invalid, please re-open in case you are not satisfied with my answer.

Note: See TracTickets for help on using tickets.