Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

mediainfo cli from bash script

Help
MCS
2013-06-03
2013-06-04
  • MCS
    MCS
    2013-06-03

    Hi. I'm trying to run the CLI on a some of my video files from a bash script that I'm working on and I can't seem to get it to work correctly. Could someone point me in the right direction? TIA. Below is a sample of some of my attempts to run mediainfo.

    mediainfo "--Inform=file://$AUDIO_TEMP $INPUT_FILE > $AUDIO_OUT"

    mediainfo --Inform="file://$AUDIO_TEMP $INPUT_FILE > $AUDIO_OUT"

    mediainfo --Inform=file://"$AUDIO_TEMP $INPUT_FILE > $AUDIO_OUT"

    mediainfo --Inform=file://"$AUDIO_TEMP $INPUT_FILE" > "$AUDIO_OUT"

    When I run the command outside of the script with the parameters valued, it runs fine, so my template file and input file don't look like they are the problems.

     
  • Kurtnoise
    Kurtnoise
    2013-06-03

    Please, describe :

    1/ Your variables $AUDIO_TEMP, $INPUT_FILE, $AUDIO_OUT
    2/ Your Operating System used

     
  • I am not an expert of bash, but quotes should be per argument, so I imagine something like:

    mediainfo "--Inform=file://$AUDIO_TEMP" "$INPUT_FILE" > "$AUDIO_OUT"

     
  • MCS
    MCS
    2013-06-03

    Thanks for the responses.

    $AUDIO_TEMP - audio-template.txt, a file in the 'pwd', describing the audio output I need.

    $INPUT_FILE - a path to the audio file I wish to run mediainfo on.

    $AUDIO_OUT - audio-info.txt, a file I create in the 'pwd', for the audio output.

    Running this on Ubuntu 12.04.

     
  • Kurtnoise
    Kurtnoise
    2013-06-03

    Ok, what do you have in your audio-template.txt file ?

    I believe that the Jerome answer is what you need...;-)

     
    Last edit: Kurtnoise 2013-06-03
  • MCS
    MCS
    2013-06-03

    There is nothing in the file. I create a parameter with the location at the beginning of the script and then have mediainfo write to that location. I then remove the file if the script executes without error.

    Thanks I will try the suggestion when I get home.

     
  • MCS
    MCS
    2013-06-04

    Cheers. Worked like a charm thanks for the help.