VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    Depending on the frame rate (29.97 or 59.94) I want to apply different processing paths to .wtv files.
    With MediaInfo CLI, I can get the value into a text file, but I can't figure how to get it into a variable to process further.

    "MediaInfo.exe", "--inform=Video;%%FrameRate%% " "C:\Users\Superuser\Desktop\dance.wtv" > "C:\Users\Superuser\Desktop\test.txt"
    Quote Quote  
  2. Check the Windows help for the FOR /F command (type for /? on the command line). If you would post the meidainfo output file I could be more specific.
    Quote Quote  
  3. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    The contents of the output text file is 59.940
    Quote Quote  
  4. Code:
    set /p fps= < "C:\Users\Superuser\Desktop\test.txt" 
    echo %fps%
    set /p input=type anything here:
    normally asks for some user string input, and it will store that string in input variable, but when you give it a text like in that line above, it is done automatically
    Last edited by _Al_; 23rd Sep 2014 at 15:12.
    Quote Quote  
  5. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    Much obliged.
    I was getting nowhere until you steered me right.

    @ echo off
    "MediaInfo.exe", "--inform=Video;%%FrameRate%% " "C:\Users\Superuser\Desktop\dance.wtv" > "C:\Users\Superuser\Desktop\test.txt"
    set /p fps= < "C:\Users\Superuser\Desktop\test.txt"

    if not %fps% == 59.940 goto test29
    echo %fps%

    :test29
    if not %fps% == 29.970 goto eof
    echo %fps%

    :eof
    Quote Quote  
  6. A Member since June, 2004 Keyser's Avatar
    Join Date
    Feb 2013
    Location
    Westernmost point of Europe
    Search Comp PM
    Just a hint. When comparing strings using variables, it's a good idea to include some character(s) in those strings to avoid errors in case the variables are empty. In your example, if %fps% is an empty string you'll get an error because the left part of the comparison can't be empty.

    So, you should use instead:

    IF NOT "%fps%" == "59.940" GOTO test29
    or
    IF NOT [%fps%] == [59.940] GOTO test29

    I used "" and [], but, in fact, you can use almost any characther. This way, if %fps% is empty, the left part of the comparison would be "" or [].
    "The greatest trick the Devil ever pulled was convincing the world he didn't exist."
    Quote Quote  
  7. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    Noted and I have made the change; thank you.
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!