Template for a custom output format having all info on one line

Help
colemar41
2014-01-04
2014-01-04
  • colemar41

    colemar41 - 2014-01-04

    MediaInfo Command line,
    MediaInfoLib - v0.7.61
    This is on Ubuntu.

    I wanted to output info for multiple files in the following fashion

    mediainfo --Output=file://$HOME/.config/mediainfo/template.txt *.mkv
    
    Lost - S05E01 - Because You Left.mkv * 1.35 GiB * 43mn 4s |Video: 1280x720 * 16:9 * AVC High@L4.0 |Audio: Italian * 2 CH * AAC LC |Audio: English * 6 CH * AC3 |Sub: English * S_TEXT/UTF8
    Lost - S05E02 - The Lie.mkv * 1 002 MiB * 42mn 11s |Video: 1280x720 * 16:9 * AVC High@L4.0 |Audio: Italian * 2 CH * AAC LC |Audio: English * 6 CH * AC3 |Sub: English * S_TEXT/UTF8
    Lost - S05E03 - Jughead.mkv * 1.44 GiB * 43mn 6s |Video: 1280x720 * 16:9 * AVC High@L4.0 |Audio: Italian * 2 CH * AAC LC |Audio: English * 6 CH * AC3 |Sub:  * S_TEXT/UTF8
    

    My template $HOME/.config/mediainfo/template.txt is as follows

    General;%CompleteName% * %FileSize/String3% * %Duration/String%
    Video; |Video: %Width%x%Height% * %DisplayAspectRatio/String% * %Format% %Format_Profile%
    Audio; |Audio: %Language/String% * %Channel(s)% CH * %Codec/String%
    Text; |Sub: %Language/String% * %Codec%\n
    

    The problem is, when the media file has no subtitles mediainfo omits the newline (\n), therefore I get one line with the info from all three media files concatenated.

    I seem to be unable to get mediainfo to print a newline no matter what.

     
  • Jerome Martinez

    Jerome Martinez - 2014-01-04

    The problem is, when the media file has no subtitles mediainfo omits the newline (\n)

    Normal, the new line is only per text stream in your template.

    Try:

    General;%CompleteName% * %FileSize/String3% * %Duration/String%
    Video; |Video: %Width%x%Height% * %DisplayAspectRatio/String% * %Format% %Format_Profile%
    Audio; |Audio: %Language/String% * %Channel(s)% CH * %Codec/String%
    Text; |Sub: %Language/String% * %Codec%
    File_End;\n
    

    Note: I am aware there is a big lack of documentation about templates, it was a prototype and I did not have the time to finish it, documentation is on the ToDo-list when I have some free time. in the meanwhile, there are some examples there.

     
  • colemar41

    colemar41 - 2014-01-04

    Very good, it works just as I intended! :)
    A million thanks, also for the examples link.

    Since I think this format has some merits, I published it here:
    http://pastebin.com/Pf0NQnhR

     
    Last edit: colemar41 2014-01-04

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks