Opened 12 years ago

Closed 12 years ago

#1588 closed defect (fixed)

ffprobe with -show_streams -show_data produces invalid xml

Reported by: dave rice Owned by:
Priority: normal Component: ffprobe
Version: git-master Keywords: ffprobe, xml
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug:

The command below produces an xml where the extradata is not encapsulated within an xml node.

How to reproduce:

I created a file with

ffmpeg -f lavfi -i testsrc=d=5 testsrc.mov

then ran:

ffprobe -report -show_streams -show_data -noprivate -print_format xml=q=1:x=1 testsrc.mov > testsrc.xml

Here is the report:

ffprobe started on 2012-07-30 at 23:08:42
Report written to "ffprobe-20120730-230842.log"
Command line:
ffprobe -report -show_streams -show_data -noprivate -print_format "xml=q=1:x=1" testsrc.mov
ffprobe version 0.11.1.git Copyright (c) 2007-2012 the FFmpeg developers
  built on Jul 16 2012 20:16:59 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/gcc-4.2 --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-libvo-aacenc --enable-libopenjpeg
  libavutil      51. 65.100 / 51. 65.100
  libavcodec     54. 40.100 / 54. 40.100
  libavformat    54. 16.104 / 54. 16.104
  libavdevice    54.  1.100 / 54.  1.100
  libavfilter     3.  2.100 /  3.  2.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[xml @ 0x1087183e0] Setting entry with key 'q' to value '1'
[xml @ 0x1087183e0] Setting entry with key 'x' to value '1'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa4a104f200] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa4a104f200] ISO: File Type Major Brand: qt  
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa4a104f200] File position before avformat_find_stream_info() is 25116
[h264 @ 0x7fa4a1057800] Using externally provided dimensions
[h264 @ 0x7fa4a1057800] no picture 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa4a104f200] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa4a104f200] File position after avformat_find_stream_info() is 3963
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'testsrc.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf54.16.104
  Duration: 00:00:05.00, start: 0.000000, bitrate: 40 kb/s
    Stream #0:0(eng), 1, 1/25: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 36 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
      handler_name    : DataHandler
[h264 @ 0x7fa4a1057800] detected 2 logical cores
[AVIOContext @ 0x108718560] Statistics: 25116 bytes read, 0 seeks

Here is the resulting XML

<?xml version="1.0" encoding="UTF-8"?>
<ffprobe:ffprobe xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ffprobe='http://www.ffmpeg.org/schema/ffprobe' xsi:schemaLocation='http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd'>
    <streams>
        <stream index="0" codec_name="h264" codec_long_name="H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10" profile="High" codec_type="video" codec_time_base="1/50" codec_tag_string="avc1" codec_tag="0x31637661" width="320" height="240" has_b_frames="2" sample_aspect_ratio="1:1" display_aspect_ratio="4:3" pix_fmt="yuv420p" level="13" r_frame_rate="25/1" avg_frame_rate="25/1" time_base="1/25" start_time="0.000000" duration="5.000000" bit_rate="36630" nb_frames="125">
            <tag key="language" value="eng"/>
            <tag key="handler_name" value="DataHandler"/>
 extradata="
00000000: 0164 000d ffe1 0019 6764 000d acd9 4141  .d......gd....AA
00000010: fb01 1000 0003 0010 0000 0303 20f1 4299  ............ .B.
00000020: 6001 0006 68eb e3cb 22c0                 `...h...&quot;.
"        </stream>
    </streams>
</ffprobe:ffprobe>

Note the extradata text in between a closed <tag> node and the end of the <stream> node.

Change History (1)

comment:1 by Stefano Sabatini, 12 years ago

Analyzed by developer: set
Component: undeterminedFFprobe
Reproduced by developer: set
Resolution: fixed
Status: newclosed

Should be fixed in:

commit 89898cd3b6b2806bf823678a47d17f9ed745c69e
Author: Nicolas George <nicolas.george@normalesup.org>
Date:   Tue Jul 31 11:53:30 2012 +0200

    ffprobe: fix validity error with tags and data.
    
    Add "data" and "extradata" attributes to the schema.
    Add "tag" element in "streams".
    Print extradata before tags to avoid closing the element.
    
    Fix trac ticket #1588.
Note: See TracTickets for help on using tickets.