VideoHelp Forum
+ Reply to Thread
Results 1 to 2 of 2
Thread
  1. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Good morning. I am trying to obtain a list of I frames from a video and will use it to convert with cutting and joining but the command line hangs after initially opening.

    CMD file
    Code:
    setlocal enabledelayedexpansion
    for /F "tokens=5,6,16,17 delims=," %%b in ('findstr /I "I" "ffprobe.csv"') do (
    set "x=%%b"
    set "y=%%c"
    set "z=%%d"
    set "w=%%e"
    
    echo !Number!  !x:~0,10!     !z:~-8!      !w:~0,8! >> "Frames.txt"
    set /A "Number=!Number!+1"
    )
    Output to Screen
    C:\Users\Bud\Desktop\parameters264\New folder>"C:\Users\Bud\Desktop\parameters264\New folder\strip ffprobecsv.cmd"

    C:\Users\Bud\Desktop\parameters264\New folder>setlocal enabledelayedexpansion

    C:\Users\Bud\Desktop\parameters264\New folder>for /F "tokens=5,6,16,17 delims=," %b in ('findstr /I "I" "ffprobe.csv"') do (
    set "x=%b"
    set "y=%c"
    set "z=%d"
    set "w=%e"
    echo !Number! !x:~0,10! !z:~-8! !w:~0,8! 1>>"Frames.txt"
    set /A "Number=!Number!+1"
    )
    It hangs at this point but if I hit control C and answer 'N' to terminating, it continues on to finish. Is there a glitch in the CLI or do I have something missing/wrong?

    Any help would be appreciated.
    Thanks
    Quote Quote  
  2. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    In case anyone is interested, (no responses so far) I searched under many many different parameters and finally found a reference to this hang.

    I just verified that it's indeed findstr that hangs, if the last input line on stdin does not end with a CR/LF.
    It seems crazy that such a bug has remained unfixed for so long!

    To reproduce the bug, create a text file with notepad, containing a single line with no end of line. Ex: "notepad t.txt" containing "Line 1"
    Then run:
    findstr Line <t.txt

    Note that find does not have that problem: The following command works:
    find "Line" <t.txt

    Possible workarounds until Microsoft fixes the bug:
    type t.txt | findstr Line
    findstr Line t.txt
    I switched to 'find' instead of 'findstr', since my search was for a simple string, and it worked fine.

    setlocal enabledelayedexpansion
    for /F "tokens=5,6,16,17 delims=," %b in ('find "I" "ffprobe.csv"') do (
    set "x=%b"
    set "y=%c"
    set "z=%d"
    set "w=%e"
    echo !Number! !x:~0,10! !z:~-8! !w:~0,8! 1>>"Frames.txt"
    set /A "Number=!Number!+1"
    )
    Last edited by Budman1; 3rd Mar 2018 at 02:19.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!