Opened 6 years ago

Closed 2 years ago

#7153 closed defect (fixed)

ffprobe show_entries: csv/compact output broken by nested section "side_data"

Reported by: nicol Owned by:
Priority: important Component: ffprobe
Version: git-master Keywords: regression
Cc: pmhahn+video@pmhahn.de Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: ffprobe show_entries packet omits "," output csv.
How to reproduce:

% ffprobe -select_streams v:0 -show_entries packet=flags input.ts -of csv
ffprobe version N-90796-ge5ba5fab49
built on ... Windows zeranoe

outputs

packet,K_side_data,

packet,__side_data,

That should be

packet,K_,side_data,

packet,__,side_data,

Output other formats are fine, default, flat, ini, json and xml.

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (4)

comment:1 by Balling, 4 years ago

Status: newopen

Funny bug)) Checked, indeed it is a problem.

comment:2 by Philipp Hahn, 4 years ago

Cc: pmhahn+video@pmhahn.de added
Priority: minornormal
Summary: ffprobe show_entries packet omits "," output csvffprobe show_entries: csv/compact output broken by nested section "side_data"
Version: unspecifiedgit-master

In fftools/ffprobe.c print_pkt_side_data() is called unconditionally from both show_packet() and show_stream(), which uses writer_print_section_header() ... writer_print_section_footer() internally to write a "sub-section" with the "side_data". As CSV (and compact) is a line oriented format, which does not support writing "nested" structures, the output is broken.

Worse then the missing comma is that writer_print_section_footer() unconditionally adds an extra newline, so the CSV output contains an empty line every two lines, which for example breaks vidcutter as it uses "-of csv" to find the keyframes and its current parser fails to handle those empty lines.

If I add a 'return' at the beginning of function print_pkt_side_data() the CSV output is correct again.

./ffprobe_g -hide_banner -v fatal -show_packets -select_streams v -show_entries packet=pts_time,flags, -of json work.mpg
{
    "packets": [
        {
            "pts_time": "9702.373522",
            "flags": "__",
            "side_data_list": [
                {
                    "side_data_type": "MPEGTS Stream ID"
                }
            ]
        },
        {
            "pts_time": "9702.333522",
            "flags": "__",
            "side_data_list": [
                {
                    "side_data_type": "MPEGTS Stream ID"
                }
            ]
        },
        {
            "pts_time": "9702.313522",
            "flags": "__"
        }
    ]
}

./ffprobe_g -hide_banner -v fatal -show_packets -select_streams v -show_entries packet=pts_time,flags, -of csv work.mpg
packet,9702.373522,__side_data,MPEGTS Stream ID

packet,9702.333522,__side_data,MPEGTS Stream ID

packet,9702.313522,__

My "work.mpg" file is a DVB-C recording from MythTV

This is broken since commit a72b61a317b0bca3e8e9c036617e9cec0c9705d0 as "ffprobe" always outputs the side data since 2015-03-03.

Either there should be an option explicitly request dumping the side data or the CSV/compact writer should be fixed to write valid CSV data again.

comment:3 by Carl Eugen Hoyos, 4 years ago

Keywords: regression added; csv removed
Priority: normalimportant

comment:4 by James, 2 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.