Opened 11 years ago

Closed 11 years ago

#2955 closed defect (duplicate)

ffprobe will output invalid XML

Reported by: eelco Owned by:
Priority: normal Component: ffprobe
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When using XML output for ffprobe, there are cases where ffprobe will output invalid XML.

We have found several cases of files (‘in the wild’) containing metadata causing this problem.

% ffprobe -show_format -print_format xml metadata-with-control-characters.avi > metadata-with-control-characters.xml
ffprobe version N-56246-g16837f9 Copyright (c) 2007-2013 the FFmpeg developers
  built on Sep 12 2013 21:13:18 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --extra-cflags='-DMACOSX_DEPLOYMENT_TARGET=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.6' --extra-ldflags='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.6'
  libavutil      52. 43.100 / 52. 43.100
  libavcodec     55. 31.101 / 55. 31.101
  libavformat    55. 16.102 / 55. 16.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 84.100 /  3. 84.100
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
Input #0, avi, from 'metadata-with-control-characters.avi':
  Metadata:
    artist          : 125
    comment         : ?
    copyright       : 8536
    encoder         : Lavf55.15.100
  Duration: 00:00:01.01, start: 0.000000, bitrate: 9629 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 512x384 [SAR 1:1 DAR 4:3], 29.97 tbr, 29.97 tbn, 29.98 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 136 kb/s

In this case a character that is illegal in XML (0x12, see http://www.w3.org/TR/REC-xml/#charsets for allowed characters) is not scrubbed from the metadata.

(Using an XML library instead of concatenating strings would prevent these kinds of bugs.)

Attachments (3)

metadata-with-control-characters.avi (1.2 MB ) - added by eelco 11 years ago.
metadata-with-control-characters.xml (501 bytes ) - added by eelco 11 years ago.
invalid-ffprobe-output.avi (79.1 KB ) - added by eelco 11 years ago.

Download all attachments as: .zip

Change History (7)

by eelco, 11 years ago

Attachment: invalid-ffprobe-output.avi added

comment:1 by eelco, 11 years ago

Component: undeterminedFFprobe
Priority: normalimportant
Version: unspecifiedgit-master

I’ve added another example of a file that causes invalid XML output from ffprobe.

comment:2 by Carl Eugen Hoyos, 11 years ago

Priority: importantnormal

Is this a regression?

comment:3 by eelco, 11 years ago

Not that I’m aware of. I don’t think it has ever worked correctly, FFmpeg always seems to dump the metadata ‘as is’, which is not really a problem when using it on the command line, but does become a problem when the encoding is explicitly specified (such as in XML).

comment:4 by Carl Eugen Hoyos, 11 years ago

Resolution: duplicate
Status: newclosed

This is apparently a duplicate of ticket #1163 (and maybe #2502), patch sent by Stefano.

Note: See TracTickets for help on using tickets.