[FFmpeg-trac] #7153(ffprobe:open): ffprobe show_entries: csv/compact output broken by nested section "side_data" (was: ffprobe show_entries packet omits ", " output csv)

FFmpeg trac at avcodec.org
Mon Jan 6 11:35:30 EET 2020


#7153: ffprobe show_entries: csv/compact output broken by nested section
"side_data"
------------------------------------+-----------------------------------
             Reporter:  nicol       |                    Owner:
                 Type:  defect      |                   Status:  open
             Priority:  normal      |                Component:  ffprobe
              Version:  git-master  |               Resolution:
             Keywords:  csv         |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-----------------------------------
Changes (by pmhahn):

 * cc: pmhahn+video@… (added)
 * priority:  minor => normal
 * version:  unspecified => git-master


Comment:

 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
 [https://github.com/ozmartian/vidcutter 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.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7153#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list