SHARE
TWEET

Untitled

a guest Mar 26th, 2020 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo OFF
  2. SETLOCAL ENABLEDELAYEDEXPANSION
  3.  
  4. set dest=C:\Users\mp\output
  5.  
  6. for /D %%d in (.\*) do (
  7.     cd %%d
  8.  
  9.     set base_directory_name=%%d
  10.     set base_directory_name=!base_directory_name:~2!
  11.    
  12.     for /R %%f in (.\*) do (
  13.         set full_file_path=%%~ff
  14.         set file_name=%%~nf
  15.  
  16.         @echo Processing !full_file_path! !file_name! in !base_directory_name!
  17.  
  18.         set before_hour=!file_name:~0,11!
  19.         set hour=!file_name:~11,2!
  20.        
  21.         set minute=!file_name:~14,2!
  22.         set after_minute=!file_name:~16!
  23.  
  24.         set /a new_hour=!hour!
  25.         set /a new_minute=!minute! + 5
  26.  
  27.         if !new_minute! GEQ 60 (
  28.             set /a new_minute=!new_minute! - 60
  29.             set /a new_hour=!new_hour! + 1
  30.         )
  31.  
  32.         if !new_minute! LSS 10 (
  33.             set new_minute=0!new_minute!
  34.         )
  35.         if !new_hour! LSS 10 (
  36.             set new_hour=0!new_hour!
  37.         )
  38.  
  39.         set dest_dir=!dest!\!base_directory_name!
  40.  
  41.         if not exist !dest_dir! mkdir !dest_dir!
  42.  
  43.         set file_name_part_one=!base_directory_name!_!file_name!.avi
  44.         set file_name_part_one_path=!dest_dir!\!file_name_part_one!
  45.         set file_name_part_two=!base_directory_name!_!before_hour!!new_hour!-!new_minute!!after_minute!.avi
  46.         set file_name_part_two_path=!dest_dir!\!file_name_part_two!
  47.  
  48.         @echo Copying !full_file_path! to !file_name_part_one_path!
  49.         %~dp0ffmpeg.exe -i !full_file_path! -c copy -t 00:05:00.0 !file_name_part_one_path!
  50.         @echo Copying !full_file_path! to !file_name_part_two_path!
  51.         %~dp0ffmpeg.exe -ss 00:05:00.0 -i !full_file_path! -c copy -t 00:05:00.0 !file_name_part_two_path!
  52.     )
  53.  
  54.     cd ..
  55. )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top