VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 46
Thread
  1. hi, this is my first thread, and sorry i not english native,

    i have this problem,
    my current hard-disk space is in red,
    i have this "homework" of videos about 45gb,
    average size of it about 300mb to 900mb(more than 60 movies),
    i like split it based scenes transition, then delete the scenes that i dont like,
    the software i looking for is :
    1. capable to split video based scene automatically
    2. capable to multiple files or batch
    3. capable to copy splitting (not re-code, because it take lot of time)
    optional (no require but, if it have i will super happy):
    A. capable to detect if splitting files have complete files(check if there any missing scenes)
    B. capable delete original file if condition in point A reached
    C free (i dont mind if it batch txt file of ffmpeg syntax)
    Quote Quote  
  2. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    I'm working on exactly what you are requesting for the exact same reasons your give (full hard drive, scenes not wanted, etc.) It is far from done yet at least to make it automatic. I can:

    Manually list all scene changes (with varying amount of difference selectable)
    Manually list all Key Frames (usually always present at Scene change anyway)
    Extract the 1st frame of all Scene changes with the time to microsecond embedded in image. (e.g. 327.127127)
    Copy exactly from the I-Frame of the wanted chunk up to the I- Frame of the unwanted one.

    Unfortunately as I said, it is manual by looking up timings, frame numbers and adjusting the batch files

    I know this doesn't help you at this time but you have listed many items that need to be included in the Windows GUI version I have just started to program tonight.
    ATM I do not know of other programs that are automated without at least viewing the first frame of each scene. I will add that feature so after looking at the thumbs, it can be checked to auto keep OR delete.
    Sorry no help unless you want the batch file scripts but Thanks for the suggestions .

    Image
    [Attachment 45808 - Click to enlarge]
    Quote Quote  
  3. Originally Posted by Budman1 View Post
    I'm working on exactly what you are requesting for the exact same reasons your give (full hard drive, scenes not wanted, etc.) It is far from done yet at least to make it automatic. I can:

    Manually list all scene changes (with varying amount of difference selectable)
    Manually list all Key Frames (usually always present at Scene change anyway)
    Extract the 1st frame of all Scene changes with the time to microsecond embedded in image. (e.g. 327.127127)
    Copy exactly from the I-Frame of the wanted chunk up to the I- Frame of the unwanted one.

    Unfortunately as I said, it is manual by looking up timings, frame numbers and adjusting the batch files

    I know this doesn't help you at this time but you have listed many items that need to be included in the Windows GUI version I have just started to program tonight.
    ATM I do not know of other programs that are automated without at least viewing the first frame of each scene. I will add that feature so after looking at the thumbs, it can be checked to auto keep OR delete.
    Sorry no help unless you want the batch file scripts but Thanks for the suggestions .

    Image
    [Attachment 45808 - Click to enlarge]
    that i wanted, "the batch file script", please share it, and the instruction of course,
    and thanks a lot for the reply.
    Quote Quote  
  4. There are lots of AVISynth scripts that do scene detection based on the changes in the video itself. I've posted quite a few of my scripts over at doom9.org. This is one such script:

    Code:
    Loadplugin("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\MVTools\mvtools2.dll")
    SetFilterMTMode("MDegrain2",     MT_MULTI_INSTANCE) 
    SetFilterMTMode("MAnalyse",      MT_MULTI_INSTANCE) 
    SetFilterMTMode("MCompensate",   MT_MULTI_INSTANCE) 
    SetFilterMTMode("MSuper",        MT_MULTI_INSTANCE) 
    SetFilterMtMode("AVISource",     MT_SERIALIZED)
    
    filename     = "e:\Scenes.txt"
    global scenethresh =2.5  #Include decimal point
    global noise_desns =0.1  #Reduce sensitivity to ratio between two very similar frames (0-3 is good range)
    BLOCKSIZE    = 16
    thSCD1       = (BLOCKSIZE*BLOCKSIZE) * 64
    
    source = AVISource("e:\fs.avi").convertTOYV12().killaudio()
    
    prefiltered =  source.blur(1.0)
    superfilt   =  MSuper(prefiltered,pel=2)
    super       =  MSuper(source,     pel=2)
    
    back_vec = MAnalyse(superfilt,isb=true,  blksize=BLOCKSIZE,overlap=2,search=0)
    forw_vec = MAnalyse(superfilt,isb=false, blksize=BLOCKSIZE,overlap=2,search=0)
    
    backcmp  = source.MCompensate(super, back_vec, thSCD1=thSCD1, thSCD2=255)
    forwcmp  = source.MCompensate(super, forw_vec, thSCD1=thSCD1, thSCD2=255)
    
    global mcomp_clip = interleave(forwcmp, source, backcmp)
    
    #---------------------------------
    #Next six lines let you view the metrics in order to set detection metrics.
    
    /*
    global script  = """Subtitle("\nScene  = " + String(  (YDifferenceToNext(mcomp_clip) + noise_desns)/ (YDifferenceFromPrevious(mcomp_clip) + noise_desns) ) + \
              "\nNextSc = " +  String(  (YDifferenceFromPrevious(trim(mcomp_clip,3,0)) + noise_desns) / (YDifferenceToNext(trim(mcomp_clip,3,0)) + noise_desns)) +   \
              "\nYDiffN  = " +  String( YDifferenceToNext(mcomp_clip)) + \
              "\nYDiffP  = " + String( YDifferenceFromPrevious(mcomp_clip)), lsp=0)"""
    global metrics = ScriptClip(mcomp_clip,script)
    final = ScriptClip(mcomp_clip,"""(YDifferenceToNext(mcomp_clip) + noise_desns) / (YDifferenceFromPrevious(mcomp_clip) + noise_desns) >  scenethresh \
            && (current_frame %3 == 1) \
            ? Subtitle(metrics,"New Scene",size=Height/4,align=5) : metrics""")
    return selectevery(final,3,1)
    */
    
    #---------------------------------
    #Evaluate every 3rd frame using Mod(3) = 1
    #Comment out next three lines when viewing metrics with code above
    
    #/*
    WriteFileIf(mcomp_clip, filename, "( (YDifferenceToNext(mcomp_clip) + noise_desns)/ (YDifferenceFromPrevious(mcomp_clip) + noise_desns) >  scenethresh) \
                 && (current_frame %3 == 1)", \
                "current_frame/3 + 1", append = false)
    #*/
    
    # Enable MT!
    #Prefetch(6)
    Quote Quote  
  5. Originally Posted by johnmeyer View Post
    There are lots of AVISynth scripts that do scene detection based on the changes in the video itself. I've posted quite a few of my scripts over at doom9.org. This is one such script:

    Code:
    Loadplugin("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\MVTools\mvtools2.dll")
    SetFilterMTMode("MDegrain2",     MT_MULTI_INSTANCE) 
    SetFilterMTMode("MAnalyse",      MT_MULTI_INSTANCE) 
    SetFilterMTMode("MCompensate",   MT_MULTI_INSTANCE) 
    SetFilterMTMode("MSuper",        MT_MULTI_INSTANCE) 
    SetFilterMtMode("AVISource",     MT_SERIALIZED)
    
    filename     = "e:\Scenes.txt"
    global scenethresh =2.5  #Include decimal point
    global noise_desns =0.1  #Reduce sensitivity to ratio between two very similar frames (0-3 is good range)
    BLOCKSIZE    = 16
    thSCD1       = (BLOCKSIZE*BLOCKSIZE) * 64
    
    source = AVISource("e:\fs.avi").convertTOYV12().killaudio()
    
    prefiltered =  source.blur(1.0)
    superfilt   =  MSuper(prefiltered,pel=2)
    super       =  MSuper(source,     pel=2)
    
    back_vec = MAnalyse(superfilt,isb=true,  blksize=BLOCKSIZE,overlap=2,search=0)
    forw_vec = MAnalyse(superfilt,isb=false, blksize=BLOCKSIZE,overlap=2,search=0)
    
    backcmp  = source.MCompensate(super, back_vec, thSCD1=thSCD1, thSCD2=255)
    forwcmp  = source.MCompensate(super, forw_vec, thSCD1=thSCD1, thSCD2=255)
    
    global mcomp_clip = interleave(forwcmp, source, backcmp)
    
    #---------------------------------
    #Next six lines let you view the metrics in order to set detection metrics.
    
    /*
    global script  = """Subtitle("\nScene  = " + String(  (YDifferenceToNext(mcomp_clip) + noise_desns)/ (YDifferenceFromPrevious(mcomp_clip) + noise_desns) ) + \
              "\nNextSc = " +  String(  (YDifferenceFromPrevious(trim(mcomp_clip,3,0)) + noise_desns) / (YDifferenceToNext(trim(mcomp_clip,3,0)) + noise_desns)) +   \
              "\nYDiffN  = " +  String( YDifferenceToNext(mcomp_clip)) + \
              "\nYDiffP  = " + String( YDifferenceFromPrevious(mcomp_clip)), lsp=0)"""
    global metrics = ScriptClip(mcomp_clip,script)
    final = ScriptClip(mcomp_clip,"""(YDifferenceToNext(mcomp_clip) + noise_desns) / (YDifferenceFromPrevious(mcomp_clip) + noise_desns) >  scenethresh \
            && (current_frame %3 == 1) \
            ? Subtitle(metrics,"New Scene",size=Height/4,align=5) : metrics""")
    return selectevery(final,3,1)
    */
    
    #---------------------------------
    #Evaluate every 3rd frame using Mod(3) = 1
    #Comment out next three lines when viewing metrics with code above
    
    #/*
    WriteFileIf(mcomp_clip, filename, "( (YDifferenceToNext(mcomp_clip) + noise_desns)/ (YDifferenceFromPrevious(mcomp_clip) + noise_desns) >  scenethresh) \
                 && (current_frame %3 == 1)", \
                "current_frame/3 + 1", append = false)
    #*/
    
    # Enable MT!
    #Prefetch(6)
    thanks for answer, sorry if ask rude question, but i not programmer ,
    1. "I've posted quite a few of my scripts over at doom9.org. This is one such script" is this parts or complete program?
    2. is this program batch-able? or i must create 1 file per video?
    Quote Quote  
  6. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Okay here is the first part (batch script) that finds the scene changes equal to .4 (40% different). I have limited the quantity somewhat by allowing to find only up to the first 14,000+ frames (about 8 minutes or 15 I-Frames/250 between each) This is prevent flooding your folder with hundreds of images. It is made to use FFMPEG and FFPROBE in the same folder as the videos. All output will go to this folder as well.

    This is a complex script and may fail with different levels of CMD (Mine is 6.1.7601) depending on how it handles quotes, mainly. It creates 2 files in addition to the images. One is the compact output of the scene change frames and all their information. The other is a shortened version for easier reading.


    INSTRUCTIONS:
    1. @echo off is used to make the output of the CMD window silent. If you have problems comment it out with double colons (::@echo off) to view errors.
    2. ::for %%a in (*.mp4,*.mpg,*.flv) Do ( is commented out to use drag and drop function. Drag a video to this CMD and it will run. To use as a batch file uncomment this line and comment the following line. BE VERY CAREFUL IN THIS MODE because FFPROBE is no speed demon and can run for a while on large files before you see any output.
    3. select=gt(scene\,.4 can be altered for more or less tolerance to scene changes. .4 is a good start but you may find things like panning a person head to toe changes slowly and may not show the feet as a change from the head since it was done slowly and the percent of change was minor frame to frame. If this is needed change the number to .3 or .2
    4. if !sort! GEQ 0 if !sort! LEQ 14000 ( allows output for frames 0 to 14000. !sort! variable keeps track and stops outputting if your file is longer. If you want a longer output or a different segment change as GEQ 14000 if !sort! LEQ 28000.
    5. The final :ause is so you can leave the CMD window open at the finish by uncommenting.
    6. fontfile=c:/Windows/Fonts/Arial.ttf may work no matter what you enter here or you may have to change to the location of your font. It depends of your PC and whether it defaults to some font.

    Code:
    setlocal enabledelayedexpansion
    @echo off
    set /a count=0
    ::for %%a in (*.mp4,*.mpg,*.flv) Do (
    for %%a in ("%~nx1") Do (
    cd %%~dpa
    echo. > "%%~na_SceneInfo.txt"
    echo Scene NO. PTS TIME     FRAME TYPE > "%%~dpna_SceneList.txt"
    ffprobe -v quiet -show_frames -of compact=p=0 -f lavfi "movie='%%a',select=gt(scene\,.4)" >> "%%~na_SceneInfo.txt"
    for /F "tokens=5,14,15,18,19 delims=|" %%b in ('findstr /I "type=" "%%~na_SceneInfo.txt"') do (
    set "x=%%b"
    set "y=%%c"
    set "z=%%d"
    set "w=%%e"
    set "v=%%f"
    set "u=%%g"
    set sort=!x:~13,-7!
    echo !sort!
    if !sort! GEQ 0 if !sort! LEQ 14000 (
    @echo !count!         !x:~13!         !w!  >> "%%~dpna_SceneList.txt"
    ffmpeg -ss !x:~13! -i "%%a" -f image2 -q:v 1 -vf "drawtext='fontfile=c:/Windows/Fonts/Arial.ttf:text='!x:~13!':x=(w-tw)/2:y=h-(2*lh): fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=30" -vframes 1 "%%~dpna_Thumb_!count!.jpg"
    )
    set /a count+=1"
    set /a ekko=count%%10"
    if !ekko!==0 echo Frame !count! processed
    )
    )
    ::pause
    If this works and you wish more scripts such as cutting Key Frame to Key Frame or List All frames with type. Let me know. also if you run into problems, please let me or others know so we can fix/help more.
    Quote Quote  
  7. Originally Posted by Budman1 View Post
    Okay here is the first part (batch script) that finds the scene changes equal to .4 (40% different). I have limited the quantity somewhat by allowing to find only up to the first 14,000+ frames (about 8 minutes or 15 I-Frames/250 between each) This is prevent flooding your folder with hundreds of images. It is made to use FFMPEG and FFPROBE in the same folder as the videos. All output will go to this folder as well.

    This is a complex script and may fail with different levels of CMD (Mine is 6.1.7601) depending on how it handles quotes, mainly. It creates 2 files in addition to the images. One is the compact output of the scene change frames and all their information. The other is a shortened version for easier reading.


    INSTRUCTIONS:
    1. @echo off is used to make the output of the CMD window silent. If you have problems comment it out with double colons (::@echo off) to view errors.
    2. ::for %%a in (*.mp4,*.mpg,*.flv) Do ( is commented out to use drag and drop function. Drag a video to this CMD and it will run. To use as a batch file uncomment this line and comment the following line. BE VERY CAREFUL IN THIS MODE because FFPROBE is no speed demon and can run for a while on large files before you see any output.
    3. select=gt(scene\,.4 can be altered for more or less tolerance to scene changes. .4 is a good start but you may find things like panning a person head to toe changes slowly and may not show the feet as a change from the head since it was done slowly and the percent of change was minor frame to frame. If this is needed change the number to .3 or .2
    4. if !sort! GEQ 0 if !sort! LEQ 14000 ( allows output for frames 0 to 14000. !sort! variable keeps track and stops outputting if your file is longer. If you want a longer output or a different segment change as GEQ 14000 if !sort! LEQ 28000.
    5. The final :ause is so you can leave the CMD window open at the finish by uncommenting.
    6. fontfile=c:/Windows/Fonts/Arial.ttf may work no matter what you enter here or you may have to change to the location of your font. It depends of your PC and whether it defaults to some font.

    Code:
    setlocal enabledelayedexpansion
    @echo off
    set /a count=0
    ::for %%a in (*.mp4,*.mpg,*.flv) Do (
    for %%a in ("%~nx1") Do (
    cd %%~dpa
    echo. > "%%~na_SceneInfo.txt"
    echo Scene NO. PTS TIME     FRAME TYPE > "%%~dpna_SceneList.txt"
    ffprobe -v quiet -show_frames -of compact=p=0 -f lavfi "movie='%%a',select=gt(scene\,.4)" >> "%%~na_SceneInfo.txt"
    for /F "tokens=5,14,15,18,19 delims=|" %%b in ('findstr /I "type=" "%%~na_SceneInfo.txt"') do (
    set "x=%%b"
    set "y=%%c"
    set "z=%%d"
    set "w=%%e"
    set "v=%%f"
    set "u=%%g"
    set sort=!x:~13,-7!
    echo !sort!
    if !sort! GEQ 0 if !sort! LEQ 14000 (
    @echo !count!         !x:~13!         !w!  >> "%%~dpna_SceneList.txt"
    ffmpeg -ss !x:~13! -i "%%a" -f image2 -q:v 1 -vf "drawtext='fontfile=c:/Windows/Fonts/Arial.ttf:text='!x:~13!':x=(w-tw)/2:y=h-(2*lh): fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=30" -vframes 1 "%%~dpna_Thumb_!count!.jpg"
    )
    set /a count+=1"
    set /a ekko=count%%10"
    if !ekko!==0 echo Frame !count! processed
    )
    )
    ::pause
    If this works and you wish more scripts such as cutting Key Frame to Key Frame or List All frames with type. Let me know. also if you run into problems, please let me or others know so we can fix/help more.
    thanks for reply, i have test this code
    Code:
    input : "Justice League 2017.avi" size : 1.41 GB (1,522,253,400 bytes)
    and output is :
    _SceneList.txt
    Code:
    Scene NO. PTS TIME     FRAME TYPE
    _SceneInfo.txt
    Code:
    
    
    yes, only a space and new line,
    and this is cmd output :
    Code:
    C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin>setlocal enabledelayedexpansion
    
    C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin>set /a count=0
    
    C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin>for %a in ("") Do (
    cd %~dpa
     echo.  1>"%~na_SceneInfo.txt"
     echo Scene NO. PTS TIME     FRAME TYPE  1>"%~dpna_SceneList.txt"
     ffprobe -v quiet -show_frames -of compact=p=0 -f lavfi "movie='%a',select=gt(scene\,.4)"  1>>"%~na_SceneInfo.txt"
     for /F "tokens=5,14,15,18,19 delims=|" %b in ('findstr /I "type=" "%~na_SceneInfo.txt"') do (
    set "x=%b"
     set "y=%c"
     set "z=%d"
     set "w=%e"
     set "v=%f"
     set "u=%g"
     set sort=!x:~13,-7!
     echo !sort!
     if !sort! GEQ 0 if !sort! LEQ 14000 (
    
     ffmpeg -ss !x:~13! -i "%a" -f image2 -q:v 1 -vf "drawtext='fontfile=c:/Windows/Fonts/Arial.ttf:text='!x:~13!':x=(w-tw)/2:y=h-(2*lh): fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=30" -vframes 1 "%~dpna_Thumb_!count!.jpg"
    )
     set /a count+=1"
     set /a ekko=count%10"
     if !ekko! == 0 echo Frame !count! processed
    )
    )
    
    C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin>(
    cd
     echo.  1>"_SceneInfo.txt"
     echo Scene NO. PTS TIME     FRAME TYPE  1>"_SceneList.txt"
     ffprobe -v quiet -show_frames -of compact=p=0 -f lavfi "movie='""',select=gt(scene\,.4)"  1>>"_SceneInfo.txt"
     for /F "tokens=5,14,15,18,19 delims=|" %b in ('findstr /I "type=" "_SceneInfo.txt"') do (
    set "x=%b"
     set "y=%c"
     set "z=%d"
     set "w=%e"
     set "v=%f"
     set "u=%g"
     set sort=!x:~13,-7!
     echo !sort!
     if !sort! GEQ 0 if !sort! LEQ 14000 (
    
     ffmpeg -ss !x:~13! -i """" -f image2 -q:v 1 -vf "drawtext='fontfile=c:/Windows/Fonts/Arial.ttf:text='!x:~13!':x=(w-tw)/2:y=h-(2*lh): fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=30" -vframes 1 "_Thumb_!count!.jpg"
    )
     set /a count+=1"
     set /a ekko=count%10"
     if !ekko! == 0 echo Frame !count! processed
    )
    )
    C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin
    
    C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin>pause
    Press any key to continue . . .
    my conclusion is, this script only detect scene yes?, splitting is using other script,
    and it will be nice if it can be batch,
    again, thanks a lot for reply, i highly appreciate it.
    Quote Quote  
  8. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    You have no -i input. Did you drag and drop a video onto the cmd file? Just running it will not work unless you uncomment the line with (*.mp4,*flv,*mpg) in it AND comment out the line with %~n1 in it. Then it will be a batch file that runs against all mp4,mpg,flv files in the same folder as the cmd file. And yes there is another splitting script but need to make sure you can run this one AS DRAG AND DROP FiRST. Then we know your dos/cmd version handles ok or needs tweaked for quotes.
    Quote Quote  
  9. Originally Posted by Budman1 View Post
    You have no -i input. Did you drag and drop a video onto the cmd file? Just running it will not work unless you uncomment the line with (*.mp4,*flv,*mpg) in it AND comment out the line with %~n1 in it. Then it will be a batch file that runs against all mp4,mpg,flv files in the same folder as the cmd file. And yes there is another splitting script but need to make sure you can run this one AS DRAG AND DROP FiRST. Then we know your dos/cmd version handles ok or needs tweaked for quotes.
    i am really really sorry, i am not programmer my self,
    literately i do not know what i am doing,

    "You have no -i input"
    what is "-i input" ?
    Did you drag and drop a video onto the cmd file??"
    no. i move to video to where batch file, ffmpeg, and ffprobe located,
    Quote Quote  
  10. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Try to reread my instructions especially number 2. Your output you sent me had the actual ffmpeg line ffmpeg -i """" because you did not drop a video onto the cmd file. The %~n1 in my script means the file name you dropped on it. If you wish to just run the script as a batch file, uncomment the preceding line by taking out the double colons (:. Then add double colons to the %~n1 line so it does does execute that line. You will also have to add *.avi so line contains (*.mp4,*.mpg,*.flv,*.avi) so all those file types will be checked and output. But a 1.4 gb will take a while to output as I mentioned in my instructions.
    Quote Quote  
  11. Originally Posted by Budman1 View Post
    Try to reread my instructions especially number 2. Your output you sent me had the actual ffmpeg line ffmpeg -i """" because you did not drop a video onto the cmd file. The %~n1 in my script means the file name you dropped on it. If you wish to just run the script as a batch file, uncomment the preceding line by taking out the double colons (:. Then add double colons to the %~n1 line so it does does execute that line. You will also have to add *.avi so line contains (*.mp4,*.mpg,*.flv,*.avi) so all those file types will be checked and output. But a 1.4 gb will take a while to output as I mentioned in my instructions.
    i have try with drag and drop the video to batch file, this is the result :
    Code:
     set "z=%d"
     set "w=%e"
     set "v=%f"
     set "u=%g"
     set sort=!x:~13,-7!
     echo !sort!
     if !sort! GEQ 0 if !sort! LEQ 14000 (
    
     ffmpeg -ss !x:~13! -i "%a" -f image2 -q:v 1 -vf "drawtext='fontfile=c:/Windows/Fonts/Arial.ttf:text='!x:~13!':x=(w-tw)/2:y=h-(2*lh): fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=30" -vframes 1 "%~dpna_Thumb_!count!.jpg"
    )
     set /a count+=1"
     set /a ekko=count%10"
     if !ekko! == 0 echo Frame !count! processed
    )
    )
    
    C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin>(
    cd C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin\
     echo.  1>"Justice League 2017_SceneInfo.txt"
     echo Scene NO. PTS TIME     FRAME TYPE  1>"C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin\Justice League 2017_SceneList.txt"
     ffprobe -v quiet -show_frames -of compact=p=0 -f lavfi "movie='"Justice League 2017.avi"',select=gt(scene\,.4)"  1>>"Justice League 2017_SceneInfo.txt"
     for /F "tokens=5,14,15,18,19 delims=|" %b in ('findstr /I "type=" "Justice League 2017_SceneInfo.txt"') do (
    set "x=%b"
     set "y=%c"
     set "z=%d"
     set "w=%e"
     set "v=%f"
     set "u=%g"
     set sort=!x:~13,-7!
     echo !sort!
     if !sort! GEQ 0 if !sort! LEQ 14000 (
    
     ffmpeg -ss !x:~13! -i ""Justice League 2017.avi"" -f image2 -q:v 1 -vf "drawtext='fontfile=c:/Windows/Fonts/Arial.ttf:text='!x:~13!':x=(w-tw)/2:y=h-(2*lh): fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=30" -vframes 1 "C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin\Justice League 2017_Thumb_!count!.jpg"
    )
     set /a count+=1"
     set /a ekko=count%10"
     if !ekko! == 0 echo Frame !count! processed
    )
    )
    
    C:\Users\Ujang\Downloads\Compressed\ffmpeg-20180529-cba1679-win64-static\bin>pause
    Press any key to continue . . .
    Justice League 2017_SceneList.txt
    Code:
    Scene NO. PTS TIME     FRAME TYPE
    once again, i am sorry for my reckless,
    and thanks for your reply and patience.
    Quote Quote  
  12. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    You should have a sceneinfo.txt also. What does it show?
    Quote Quote  
  13. Originally Posted by Budman1 View Post
    You should have a sceneinfo.txt also. What does it show?
    same as previously, a space, and new line
    Quote Quote  
  14. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Did the script create any jpg files?
    Quote Quote  
  15. Originally Posted by Budman1 View Post
    Did the script create any jpg files?
    no, only
    2 text files created
    Quote Quote  
  16. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    I think i see problem. Getting double quotes,


    ffmpeg -ss !x:~13! -i ""Justice League 2017.avi""

    I'll fix and repost version that should work. This is what I mentioned earlier.
    Quote Quote  
  17. Originally Posted by Budman1 View Post
    I think i see problem. Getting double quotes,


    ffmpeg -ss !x:~13! -i ""Justice League 2017.avi""

    I'll fix and repost version that should work. This is what I mentioned earlier.
    i just create a new batch :
    Code:
    ffmpeg -ss !x:~13! -i ""Justice League 2017.avi""
    pause
    and this is the result
    Code:
    C:\ffmpeg\bin>ffmpeg -ss !x:~13! -i ""Justice League 2017.avi""
    ffmpeg version N-91181-gcba167934b Copyright (c) 2000-2018 the FFmpeg developers
      built with gcc 7.3.0 (GCC)
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
      libavutil      56. 18.102 / 56. 18.102
      libavcodec     58. 19.104 / 58. 19.104
      libavformat    58. 17.100 / 58. 17.100
      libavdevice    58.  4.100 / 58.  4.100
      libavfilter     7. 24.100 /  7. 24.100
      libswscale      5.  2.100 /  5.  2.100
      libswresample   3.  2.100 /  3.  2.100
      libpostproc    55.  2.100 / 55.  2.100
    Invalid duration specification for ss: !x:~13!
    
    C:\ffmpeg\bin>pause
    Press any key to continue . . .
    Quote Quote  
  18. i have try with other video and work
    Ghost.in.The.Shell.2017_SceneList.txt
    Code:
    Scene NO. PTS TIME     FRAME TYPE 
    0         144.000000         pict_type=I  
    1         159.233333         pict_type=I  
    2         163.366667         pict_type=I  
    3         165.133333         pict_type=I  
    4         191.233333         pict_type=I  
    5         196.333333         pict_type=I  
    6         198.500000         pict_type=I  
    7         205.766667         pict_type=I  
    8         208.800000         pict_type=I  
    9         210.266667         pict_type=I  
    570         5834.766667         pict_type=I  
    571         5846.766667         pict_type=I  
    572         5850.300000         pict_type=I  
    573         5858.600000         pict_type=I  
    574         5866.366667         pict_type=I  
    575         5870.466667         pict_type=I  
    576         5873.366667         pict_type=I  
    577         5879.833333         pict_type=I
    Ghost.in.The.Shell.2017_SceneInfo.txt
    Code:
     
    media_type=video|stream_index=0|key_frame=1|pkt_pts=4320|pkt_pts_time=144.000000|pkt_dts=4320|pkt_dts_time=144.000000|best_effort_timestamp=4320|best_effort_timestamp_time=144.000000|pkt_duration=1|pkt_duration_time=0.033333|pkt_pos=26298306|pkt_size=864000|width=720|height=400|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=0.513957
    note : because too long i trim some of it

    and for "Justice League 2017.avi"
    i test it why it not work, turn out it not AVI, it MKV rename as AVI
    Code:
    Complete name        : C:\ffmpeg\bin\Justice League 2017.avi
    Format                      : Matroska
    for my reckless, i am really really sorry,
    Quote Quote  
  19. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    The problem is that the AVI had spaces in the filename and the MKV did not. The following should handle files with spaces.. I changed the movie='%%a' to read movie='%~nx1' which will not add quotes to a filename with spaces. the movie=filename must be enclosed in single quotes but movie='%%a' ends up being movie='"C:\ffmpeg\bin\Justice League 2017.avi"' with extra double quotes which caused errors. I also added the line '@echo !count! !x:~13! !w! >> "%%~dpna_SceneList.txt"' so the Scenelist.txt is not empty. Remember that the program only outputs jpg's for scene changes up to 14000 frames. If you want more change the 14000 to a larger number but test first to see how many you get from 14000 first,

    Code:
    setlocal enabledelayedexpansion
    ::@echo off
    set /a count=0
    ::for %%a in (*.mp4,*.mpg,*.flv) Do (
    for %%a in ("%~nx1") Do (
    cd %%~dpa
    echo. > "%%~na_SceneInfo.txt"
    set "FileName=%%a"
    echo !FileName!
    echo Scene NO. PTS TIME     FRAME TYPE > "%%~dpna_SceneList.txt"
    ffprobe -show_frames -of compact=p=0 -f lavfi "movie='%~nx1',select=gt(scene\,.4)" >> "%%~na_SceneInfo.txt"
    for /F "tokens=5,14,15,18,19 delims=|" %%b in ('findstr /I "type=" "%%~na_SceneInfo.txt"') do (
    set "x=%%b"
    set "y=%%c"
    set "z=%%d"
    set "w=%%e"
    set "v=%%f"
    set "u=%%g"
    set sort=!x:~13,-7!
    echo !sort!
    if !sort! GEQ 0 if !sort! LEQ 14000 (
    @echo !count!         !x:~13!         !w!  >> "%%~dpna_SceneList.txt"
    ffmpeg -ss !x:~13! -i %%a -f image2 -q:v 1 -vf "drawtext='fontfile=c:/Windows/Fonts/Arial.ttf:text='!x:~13!':x=(w-tw)/2:y=h-(2*lh): fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=30" -vframes 1 "%%~dpna_Trim_Thumb_!count!.jpg"
    )
    set /a count+=1"
    set /a ekko=count%%10"
    if !ekko!==0 echo Frame !count! processed
    )
    )
    ::pause
    Quote Quote  
  20. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Drag and drop just to list:

    Code:
    setlocal enabledelayedexpansion
    ::@echo off
    set /a count=0
    ::for %%a in (*.mp4,*.mpg,*.flv) Do (
    for %%a in ("%~nx1") Do (
    cd %%~dpa
    echo. > "%%~na_SceneInfo.txt"
    echo Scene NO. PTS TIME     FRAME TYPE > "%%~dpna_SceneList.txt"
    ffprobe -v quiet -show_frames -of compact=p=0 -f lavfi "movie='%~nx1',select=gt(scene\,.4)" >> "%%~na_SceneInfo.txt"
    for /F "tokens=5,14,15,18,19 delims=|" %%b in ('findstr /I "type=" "%%~na_SceneInfo.txt"') do (
    set "x=%%b"
    set "y=%%c"
    set "z=%%d"
    set "w=%%e"
    set "v=%%f"
    set "u=%%g"
    @echo !count!         !x:~13!         !w!  >> "%%~dpna_SceneList.txt"
    set /a count+=1"
    set /a ekko=count%%10"
    if !ekko!==0 echo Frame !count! processed
    )
    )
    Quote Quote  
  21. Originally Posted by Budman1 View Post
    The problem is that the AVI had spaces in the filename and the MKV did not. The following should handle files with spaces.. I changed the movie='%%a' to read movie='%~nx1' which will not add quotes to a filename with spaces. the movie=filename must be enclosed in single quotes but movie='%%a' ends up being movie='"C:\ffmpeg\bin\Justice League 2017.avi"' with extra double quotes which caused errors. I also added the line '@echo !count! !x:~13! !w! >> "%%~dpna_SceneList.txt"' so the Scenelist.txt is not empty. Remember that the program only outputs jpg's for scene changes up to 14000 frames. If you want more change the 14000 to a larger number but test first to see how many you get from 14000 first,

    Code:
    setlocal enabledelayedexpansion
    ::@echo off
    set /a count=0
    ::for %%a in (*.mp4,*.mpg,*.flv) Do (
    for %%a in ("%~nx1") Do (
    cd %%~dpa
    echo. > "%%~na_SceneInfo.txt"
    set "FileName=%%a"
    echo !FileName!
    echo Scene NO. PTS TIME     FRAME TYPE > "%%~dpna_SceneList.txt"
    ffprobe -show_frames -of compact=p=0 -f lavfi "movie='%~nx1',select=gt(scene\,.4)" >> "%%~na_SceneInfo.txt"
    for /F "tokens=5,14,15,18,19 delims=|" %%b in ('findstr /I "type=" "%%~na_SceneInfo.txt"') do (
    set "x=%%b"
    set "y=%%c"
    set "z=%%d"
    set "w=%%e"
    set "v=%%f"
    set "u=%%g"
    set sort=!x:~13,-7!
    echo !sort!
    if !sort! GEQ 0 if !sort! LEQ 14000 (
    @echo !count!         !x:~13!         !w!  >> "%%~dpna_SceneList.txt"
    ffmpeg -ss !x:~13! -i %%a -f image2 -q:v 1 -vf "drawtext='fontfile=c:/Windows/Fonts/Arial.ttf:text='!x:~13!':x=(w-tw)/2:y=h-(2*lh): fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=30" -vframes 1 "%%~dpna_Trim_Thumb_!count!.jpg"
    )
    set /a count+=1"
    set /a ekko=count%%10"
    if !ekko!==0 echo Frame !count! processed
    )
    )
    ::pause
    thanks, Justice League 2017.avi now working,
    this is first and last 5 line each text :
    Justice League 2017_SceneList.txt
    Code:
    Scene NO. PTS TIME     FRAME TYPE 
    0         18.685000         pict_type=I  
    1         40.499000         pict_type=I  
    2         141.600000         pict_type=I  
    3         149.024000         pict_type=I  
    4         255.922000         pict_type=I  
    5         258.508000         pict_type=I  
    1267         7158.026000         pict_type=I  
    1268         7160.361000         pict_type=I  
    1269         7162.113000         pict_type=I  
    1270         7166.534000         pict_type=I  
    1271         7175.335000         pict_type=I
    Justice League 2017_SceneInfo.txt
    Code:
    media_type=video|stream_index=0|key_frame=1|pkt_pts=18685|pkt_pts_time=18.685000|pkt_dts=18685|pkt_dts_time=18.685000|best_effort_timestamp=18685|best_effort_timestamp_time=18.685000|pkt_duration=N/A|pkt_duration_time=N/A|pkt_pos=4851082|pkt_size=2764800|width=1280|height=720|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=0.497189
    media_type=video|stream_index=0|key_frame=1|pkt_pts=40499|pkt_pts_time=40.499000|pkt_dts=40499|pkt_dts_time=40.499000|best_effort_timestamp=40499|best_effort_timestamp_time=40.499000|pkt_duration=N/A|pkt_duration_time=N/A|pkt_pos=9457828|pkt_size=2764800|width=1280|height=720|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=1.000000
    media_type=video|stream_index=0|key_frame=1|pkt_pts=141600|pkt_pts_time=141.600000|pkt_dts=141600|pkt_dts_time=141.600000|best_effort_timestamp=141600|best_effort_timestamp_time=141.600000|pkt_duration=N/A|pkt_duration_time=N/A|pkt_pos=21864801|pkt_size=2764800|width=1280|height=720|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=0.464162
    media_type=video|stream_index=0|key_frame=1|pkt_pts=149024|pkt_pts_time=149.024000|pkt_dts=149024|pkt_dts_time=149.024000|best_effort_timestamp=149024|best_effort_timestamp_time=149.024000|pkt_duration=N/A|pkt_duration_time=N/A|pkt_pos=23207600|pkt_size=2764800|width=1280|height=720|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=0.433801
    media_type=video|stream_index=0|key_frame=1|pkt_pts=255922|pkt_pts_time=255.922000|pkt_dts=255922|pkt_dts_time=255.922000|best_effort_timestamp=255922|best_effort_timestamp_time=255.922000|pkt_duration=N/A|pkt_duration_time=N/A|pkt_pos=45491493|pkt_size=2764800|width=1280|height=720|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=0.591469
    media_type=video|stream_index=0|key_frame=1|pkt_pts=7158026|pkt_pts_time=7158.026000|pkt_dts=7158026|pkt_dts_time=7158.026000|best_effort_timestamp=7158026|best_effort_timestamp_time=7158.026000|pkt_duration=41|pkt_duration_time=0.041000|pkt_pos=1512493507|pkt_size=2764800|width=1280|height=720|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=0.598615
    media_type=video|stream_index=0|key_frame=1|pkt_pts=7160361|pkt_pts_time=7160.361000|pkt_dts=7160361|pkt_dts_time=7160.361000|best_effort_timestamp=7160361|best_effort_timestamp_time=7160.361000|pkt_duration=41|pkt_duration_time=0.041000|pkt_pos=1512756864|pkt_size=2764800|width=1280|height=720|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=0.593984
    media_type=video|stream_index=0|key_frame=1|pkt_pts=7162113|pkt_pts_time=7162.113000|pkt_dts=7162113|pkt_dts_time=7162.113000|best_effort_timestamp=7162113|best_effort_timestamp_time=7162.113000|pkt_duration=41|pkt_duration_time=0.041000|pkt_pos=1513013019|pkt_size=2764800|width=1280|height=720|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=0.598409
    media_type=video|stream_index=0|key_frame=1|pkt_pts=7166534|pkt_pts_time=7166.534000|pkt_dts=7166534|pkt_dts_time=7166.534000|best_effort_timestamp=7166534|best_effort_timestamp_time=7166.534000|pkt_duration=41|pkt_duration_time=0.041000|pkt_pos=1513591438|pkt_size=2764800|width=1280|height=720|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=0.553892
    media_type=video|stream_index=0|key_frame=1|pkt_pts=7175335|pkt_pts_time=7175.335000|pkt_dts=7175335|pkt_dts_time=7175.335000|best_effort_timestamp=7175335|best_effort_timestamp_time=7175.335000|pkt_duration=41|pkt_duration_time=0.041000|pkt_pos=1516657350|pkt_size=2764800|width=1280|height=720|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified|tag:lavfi.scene_score=0.483217
    Quote Quote  
  22. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Great. Just a question but did it create jpg images for those scene changes?
    Quote Quote  
  23. Originally Posted by Budman1 View Post
    Great. Just a question but did it create jpg images for those scene changes?
    yes of course, hundreds of it, but i just delete it two hour ago
    Quote Quote  
  24. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Okay great. Just for information, You can receive less jpg by changing LSS 14000 to a smaller number like LSS 2000. The numbers are the integer of timecode so GEQ 100 ... LSS 200 would mean jpgs and listing between 100 seconds and 200 seconds. Or you can use the other script which just lists without extracting jogs. Thanks
    Quote Quote  
  25. Originally Posted by Budman1 View Post
    Okay great. Just for information, You can receive less jpg by changing LSS 14000 to a smaller number like LSS 2000. The numbers are the integer of timecode so GEQ 100 ... LSS 200 would mean jpgs and listing between 100 seconds and 200 seconds. Or you can use the other script which just lists without extracting jogs. Thanks
    sorry, but is the jpgs parts is important? can be skipped?
    and one more thing the script to split, i hope it direct copy steraming (not recoding, because it will take lot of time)
    Quote Quote  
  26. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    No the jpg is not important. I find it helps me in case several scenes go back and forth several times and i wish to visually see that to cut long repeats out.

    Yes script is copy, which is why I began all this research since most copy methods failed me and you lose some quality during recoding. I am still testing with other formats but so far it works with mp4, avc (264), closed gop format. It is complex batch which is also why I am attempting to make a GUI Windows version that will also do batch files. Give me a little more testing and I'll post batch file and then GUI. THANKS
    Quote Quote  
  27. Originally Posted by Budman1 View Post
    No the jpg is not important. I find it helps me in case several scenes go back and forth several times and i wish to visually see that to cut long repeats out.

    Yes script is copy, which is why I began all this research since most copy methods failed me and you lose some quality during recoding. I am still testing with other formats but so far it works with mp4, avc (264), closed gop format. It is complex batch which is also why I am attempting to make a GUI Windows version that will also do batch files. Give me a little more testing and I'll post batch file and then GUI. THANKS
    Thanks for your hard work, I will wait for it.
    Quote Quote  
  28. btw. once you have a list of the frame numbers of the scene changes using one of ffmpegs segment-options might make things easier,...
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  29. Originally Posted by Selur View Post
    btw. once you have a list of the frame numbers of the scene changes using one of ffmpegs segment-options might make things easier,...
    how you do that? ( i am not programmer my self )
    Quote Quote  
  30. that's why I linked to the description of the function in the ffmpeg manual. (haven't used the option for years, but it should work,..)
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  



Similar Threads

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