Opened 3 years ago

Last modified 11 months ago

#7153 open defect

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 (3)

comment:1 Changed 13 months ago by Balling

  • Status changed from new to open

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

comment:2 Changed 11 months ago by pmhahn

  • Cc pmhahn+video@pmhahn.de added
  • Priority changed from minor to normal
  • Summary changed from ffprobe show_entries packet omits "," output csv to ffprobe show_entries: csv/compact output broken by nested section "side_data"
  • Version changed from unspecified to git-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 Changed 11 months ago by cehoyos

  • Keywords regression added; csv removed
  • Priority changed from normal to important
Note: See TracTickets for help on using tickets.