Opened 4 years ago

Last modified 4 years ago

#9144 new defect

ffmetadata has inconsistent escaping

Reported by: Federico Carboni Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: metadata, ffmetadata
Cc: Michael Lelli Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

;FFMETADATA1
key=value\\
key2=value

The backslash here is used to escape itself, not the following newline character. Yet the ffmetadata demuxer will read a key with value 'value
\nkey2=value'.

This behavior can also be observed by creating an ffmeta file with ffmpeg and probing it with ffprobe.

# Double backslash for terminal escaping
$ ffmpeg -metadata key=value\\ any.ffmeta
...
Output #0, ffmetadata, to 'any.ffmeta':
  Metadata:
    key             : value\
    encoder         : Lavf58.45.100
$ ffprobe any.ffmeta
...
Input #0, ffmetadata, from 's.ffmeta':
  Metadata:
    key             : value\
                    : encoder=Lavf58.45.100
# The encoder metadata property is gone.
...

Change History (1)

comment:1 by Michael Lelli, 4 years ago

Cc: Michael Lelli added

I've discovered if you use Windows-style newlines (\r\n) instead of Unix style (\n) you can avoid this bug.

Note: See TracTickets for help on using tickets.