shellffmpegmp3m4a

ffmpeg - multiline text in metadata (comment tag)


I use ffmpeg to update metadata tags like this way:

ffmpeg -i "in.m4a" -acodec copy -metadata artist="artist text"
-metadata comment="comment text" "out.m4a"

Well, "artist text" and "comment text" is usual plain text, but comment field allows to put multiline text. Each line must have new line character to do it. Something like this:

-metadata comment="source: lastfm \r\n tags: tag1, tag2 \r\n ..."

But all characters that I use (\r\n, %nl%, ^N) bring no result.

I run ffmpeg.exe from PHP script on Windows using shell_exec() function

Someone help please, or tell me is it really possible?...


Solution

  • You can do this with PowerShell using the `n for a newline and optionally `r for carriage return

    ffmpeg -i in.m4a -metadata comment="hello`nworld" out.m4a
    

    Windows default shell is cmd.exe so you may need to invoke like this

    powershell ffmpeg -i in.m4a -metadata comment="hello`nworld" out.m4a
    

    Output

    Output #0, ipod, to 'out.m4a':
      Metadata:
        major_brand     : M4A
        minor_version   : 512
        compatible_brands: isomiso2
        comment         : hello
                        : world
        encoder         : Lavf55.1.100