VideoHelp Forum
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. Set of video files in the same directory
    ---------------------------------------------------
    1. video_01------1920x1080-----23.976 fps
    2. video_03-------720x480-------29.97 fps
    3. file1------------1280x720-------23.976 fps
    4. video_02-----1920x1080------29.97 fps
    5. watchme-------720×576-------29.97 fps
    6. video.....

    Basically a mixed bag of video files in different resolution, different name, different fps and different aspect ratio.
    ----------------------------------------------------------------------------------------------------------------------

    Currently what I am doing is sorting and grouping the different video files into sub directories.
    FOR EXAMPLE: One sub directory named "HIGH 23" with would contain video files with resolution of 1920x1080 and 23.976 only.

    This process that I am doing is very manual. I would like this process to be automated.

    ######### THIS IS MY CURRENT SCRIPT/BAT FILE###########

    @echo off

    ---DEMUXS ALL FILES----
    For %%a in ("*.MTS") do "eac3to.exe" %%a -demux

    ---CONVERT SUP SUBTITLE(ENGLISH ONLY) INTO FILE IDX FORMAT---
    For %%a in ("*english*.SUP") do "java.exe" -jar "BDSup2Sub.jar" "%%a" "%%~na_New.idx"

    ----RENAME FILE SO IT MATCHS FILENAMING OF ORGINAL FILE----
    FOR %%a in ("*.MTS") do ren "%%~na*_new.idx" "%%~na.idx"
    FOR %%a in ("*.MTS") do ren "%%~na*_new.sub" "%%~na.sub"

    ----Cleans up the files, Leaves only MTS and IDXs Files----
    For %%a in ("*.MTS") do DEL *.VC1
    For %%a in ("*.MTS") do DEL *.AC3
    For %%a in ("*.MTS") do DEL *.SUP
    For %%a in ("*.MTS") do DEL *.M2V
    For %%a in ("*.MTS") do DEL *.H264
    For %%a in ("*.MTS") do DEL *.DTS

    ---CONVERT VIDEO FILE----

    @@ PART 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @
    ~~~HAS LOW 23FPS~~~
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -f ac3 -acodec ac3 -ab 128K -ar 44100 -vn -sn "%%~na.ac3"
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -b 1500K -pass 1 -passlogfile "%%~na.log" -an -sn -vcodec libx264 -r 23.976 -f h264 NUL
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -b 1500K -pass 2 -passlogfile "%%~na.log" -an -sn -vcodec libx264 -r 23.976 -f h264 -y "%%~na.264"
    ----MERGE INTO MP4 23FPS CONTAINER----
    ----MERGE VIDEO, AUDIO, SUBTITLE INTO MP4----
    For %%a in (*.MTS) do "MP4Box.exe" -add "%%~na.264" -fps 23.976 -add "%%~na.idx" -add "%%~na.ac3" "%%~na.mp4"
    ----MP4BOX THROWS ERRORS ON FILES THAT DO NOT HAVE SUBTITLES----
    ----MAKE CURRENT MP4 FILES READ ONLY----
    Attrib *.MP4 +r
    ----MERGE VIDEO, AUDIO INTO MP4-----
    For %%a in (*.MTS) do "MP4Box.exe" -add "%%~na.264" -fps 23.976 -add "%%~na.ac3" "%%~na.mp4"

    @@ PART 2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@
    ~~~HAS LOW 29FPS~~~
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -f ac3 -acodec ac3 -ab 128K -ar 44100 -vn -sn "%%~na.ac3"
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -b 1500K -pass 1 -passlogfile "%%~na.log" -an -sn -vcodec libx264 -r 29.976 -f h264 NUL
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -b 1500K -pass 2 -passlogfile "%%~na.log" -an -sn -vcodec libx264 -r 29.976 -f h264 -y "%%~na.264"
    ----MERGE INTO MP4 29FPS CONTAINER----
    ----MERGE VIDEO, AUDIO, SUBTITLE INTO MP4----
    For %%a in (*.MTS) do "MP4Box.exe" -add "%%~na.264" -fps 29.976 -add "%%~na.idx" -add "%%~na.ac3" "%%~na.mp4"
    ----MP4BOX THROWS ERRORS ON FILES THAT DO NOT HAVE SUBTITLES----
    ----MAKE CURRENT MP4 FILES READ ONLY----
    Attrib *.MP4 +r
    ----MERGE VIDEO, AUDIO INTO MP4-----
    For %%a in (*.MTS) do "MP4Box.exe" -add "%%~na.264" -fps 29.976 -add "%%~na.ac3" "%%~na.mp4"

    @@ PART 3 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@
    ~~~HAS HIGH 23FPS~~~
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -f ac3 -acodec ac3 -ab 256K -ar 48000 -vn -sn "%%~na.ac3"
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -b 8500K -pass 1 -passlogfile "%%~na.log" -an -sn -vcodec libx264 -r 23.976 -f h264 NUL
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -b 8500K -pass 2 -passlogfile "%%~na.log" -an -sn -vcodec libx264 -r 23.976 -f h264 -y "%%~na.264"
    ----MERGE INTO MP4 23FPS CONTAINER----
    ----MERGE VIDEO, AUDIO, SUBTITLE INTO MP4----
    For %%a in (*.MTS) do "MP4Box.exe" -add "%%~na.264" -fps 23.976 -add "%%~na.idx" -add "%%~na.ac3" "%%~na.mp4"
    ----MP4BOX THROWS ERRORS ON FILES THAT DO NOT HAVE SUBTITLES----
    ----MAKE CURRENT MP4 FILES READ ONLY----
    Attrib *.MP4 +r
    ----MERGE VIDEO, AUDIO INTO MP4-----
    For %%a in (*.MTS) do "MP4Box.exe" -add "%%~na.264" -fps 23.976 -add "%%~na.ac3" "%%~na.mp4"

    @@ PART 4 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@
    ~~~HAS HIGH 29FPS~~~
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -f ac3 -acodec ac3 -ab 256K -ar 48000 -vn -sn "%%~na.ac3"
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -b 8500K -pass 1 -passlogfile "%%~na.log" -an -sn -vcodec libx264 -r 29.976 -f h264 NUL
    For %%a in ("*.MTS") do "ffmpeg.exe" -i "%%a" -b 8500K -pass 2 -passlogfile "%%~na.log" -an -sn -vcodec libx264 -r 29.976 -f h264 -y "%%~na.264"
    ----MERGE INTO MP4 29FPS CONTAINER----
    ----MERGE VIDEO, AUDIO, SUBTITLE INTO MP4----
    For %%a in (*.MTS) do "MP4Box.exe" -add "%%~na.264" -fps 29.976 -add "%%~na.idx" -add "%%~na.ac3" "%%~na.mp4"
    ----MP4BOX THROWS ERRORS ON FILES THAT DO NOT HAVE SUBTITLES----
    ----MAKE CURRENT MP4 FILES READ ONLY----
    Attrib *.MP4 +r
    ----MERGE VIDEO, AUDIO INTO MP4-----
    For %%a in (*.MTS) do "MP4Box.exe" -add "%%~na.264" -fps 29.976 -add "%%~na.ac3" "%%~na.mp4"

    ----AFTER ALL THE MP4 CREATED, IT DELETES ALL "TEMP" FILES
    DEL *.264
    DEL *.AC3
    DEL *.log
    DEL *.mbtree
    DEL *.IDX
    DEL *.SUB
    DEL *.temp
    DEL *.txt

    #########################END OF CURRENT SCRIPT/BAT FILE##########

    Set of video files in the same directory
    ---------------------------------------------------
    1. video_01------1920x1080-----23.976 fps
    2. video_03-------720x480-------29.97 fps
    3. file1------------1280x720-------23.976 fps
    4. video_02-----1920x1080------29.97 fps
    5. watchme-------720×576-------29.97 fps
    6. video.....


    basically a mixed bag of video files in different resolution, different name, different fps and different aspect ratio.
    ----------------------------------------------------------------------------------------------------------------------

    i would like to have this process total automated where i am not sorting the files into different directories.
    so for file 1. it would excute part 3, for file 2. it would excute part 2. so on....

    i am making an assumapation that it would require a program like mediainfo to extract the resolution and fps.

    any suggestions or even different alternative.

    thanks
    Last edited by Baldrick; 1st Aug 2012 at 17:28. Reason: New title
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Please don't cross post. I removed your other thread.


    Mediainfo has a command line version. But I have no idea how you would use it in a batch. Try search in stackoverflow, see like http://stackoverflow.com/questions/6559048/read-file-output-into-a-variable
    Quote Quote  
  3. Member bat999's Avatar
    Join Date
    Feb 2008
    Location
    United Kingdom
    Search Comp PM
    ...
    Last edited by bat999; 8th Aug 2012 at 00:10.
    Quote Quote  



Similar Threads

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