Quantcast
Channel: xda-developers - Android Themes
Viewing all articles
Browse latest Browse all 4090

[BOOTANIMATION][TOOL][WIN][v1.1]Convert your boot animations to video ba2mp4

$
0
0
This is a Windows tool that will pull your boot animation from your device, or use a boot animation saved on your computer; and convert it into a mp4 video.

I made this because I couldn't find a way to do this and I like to see boot animations repeat at the end waiting for boot, instead of just playing the parts that are labeled to play "0" times just once, i.e. play until booted. I am also a little tired of seeing boot animations on Youtube taken with a camcorder. I've searched on google and the popular search is of course: turn video into boot animation, this however is the opposite. And a lot harder I might add.:D"

I made it to automatically unzip your boot animation zip, read the desc.txt, and turn it into a mp4 that repeats the last segment how many times you specify. It will also repeat folders, and add frames onto folders that call for a pause, all as directed by the desc.txt. Adding a pause to the end of a boot animation folder (any folder first; middle; last) isn't that common. But if you take a look at the Nexus 7 particles boot animation below, you'll see that 17 frame pause at the end of both parts is crucial to the pulsing effect.

It also converts to the gif format if you oblige, but that is just a side benefit. Many other output formats are available, I'm just not sure what other formats people would like.

Reads both jpg and png image formats.
Uses adb to pull the bootanimation.zip from /data/local/ by default, but you can specify a different filename and folder.
You can work with any number of zip files stored in the folder bazips\.
You have the ability to alter resolution, frame rate, and compression of the video.
You can concatenate all videos in the folder bavideos\ with two buttons
You can concatenate videos in bavideos\ if they share a certain string in their filename.
Filenames include fps, resolution, root zip name, compression level and timestamp
Currently this only works with up to 6 image folders (or parts), but from the 60+ boot animations I've downloaded for testing; only one has had more than six folders, with most 3 or less. If I get any feedback I will redo how I read the desc.txt file and support unlimited folders. I also have some more things that I'd like to do given there is enough feedback.
Notes:
I've straightened out the program so it will handle zip files with )( and spaces. On the super rare occasion you may end up with a zip that has & in the name, you may have to delete it from the zip filename, for it to be unzipped correctly. Same goes for other random characters.

Will not work if there are any comments at the beginning of the desc.txt file. Only had one of those too in all the tests. If your desc.txt does have comments in it and you want to make the boot animation into a video, unzip it, edit the desc.txt file with Notepad++ and take the comments out. Rezip it.
Download ba2mp4 v1.1

This rar file contains three programs, two dll files, and the batch script ba2mp4.bat
The programs included are adb, 7za, and ffmpeg.
All of these need to be unzipped into the same directory.
Then run the batch file.

Adb is needed to pull your bootanimation from your device.
7za is more commonly recognized as 7-zip, I use it to unzip your boot animation zip.
Ffmpeg is the program I use to convert the png/jpg images into a mp4.
The two dll files are for Adb to function properly.

You must have your adb drivers installed and functioning in order to pull your boot animation from your device!!!

When you first run the program ba2mp4.bat You won't be able to access menu options 2 and 3 until you get files into the folders bazips\ and bavideos\. You can either pull your bootanimation zip from your device or drop zip files in the bazips\ folder. The video folder bavideos\ is where the finished videos and/or gifs will go.




This is my 2013 Nexus 7 bootanimation recorded at default resolution and framerate (from desc.txt) with a compression factor of 0, and repeat last segment at 6 times. The upload to Youtube was ~72 MB because of the lossless compression. This video would not even play on my computer because of the compression, Youtube took it and played it after they do all their optimizations. I wouldn't recommend using crf 0 as the quality unless you have a super computer. The default value is 23.

I did not make this bootanimation, or any of these, just the video. Here is the link to the thread.



These next two I doubled the resolution on to make Youtube give the "HD" option. Some of them, it seems, might be 720x1280 but Youtube won't view it as 720p because it is portrait mode. I'm not real sure, these are the only videos I've ever downloaded to Youtube. Thanks to @Frigorio for the first one below. Here is the link to his thread.



This video below shows the concatenation feature. I used only videos in my "bavideos" folder that contained the string "x1280" and came up with this video. I wish I would of doubled the resolution on them to make Youtube give me the "HD" option, but you get the point.
Thanks to @raishiro for the following sweet animations, also the black and white funky one up above. Here is the forum link to these bootanimations.



This guy is a really good animator. I doubled the resolution on this one also, and set the end to repeat 6 times, I think. Anyways they're done by @overhauling it can be found here!



Changelog:
 

v1.0 2/16/14
Initial upload
v1.1 2/16/14
Fixed bug in repeating folders that weren't the last folder
Added fps and frames in each folder when inputting repeats of the folders with repeat "0"
Changed the number of lines in zip file select screen from 200 to 70
Several small changes




Here is the batch script:
 
Code:

@ECHO OFF
        MODE CON:COLS=57 LINES=60
        color 0B
        SET "vers=1.0"
        TITLE Bootanimation to mp4 v%vers%
        SET "outputtogif="
        SET "androidfolder=/data/local/"
        SET "savefolder=bavideos"
        SET "ext=jpg"
        SET "savename=bootanimation"
        SET "quality=-crf 23"
        SET "videotype=mp4"
        SET "ffdebug=-loglevel fatal"
        SET "ffshowb=-hide_banner"
        SET "stno=-start_number 0"
        SET "stnorng=-start_number_range 99"
        IF "%~1"=="-d" (
                SET "debugmode=1"
                SET "ffdebug=-loglevel debug"
                SET "ffshowb=%"
                MODE CON:COLS=140 LINES=250
                COLOR 07
        )
        IF NOT EXIST bazips\ MKDIR bazips
        IF NOT EXIST %savefolder% MKDIR %savefolder%
        IF EXIST concatallthese.txt DEL concatallthese.txt
        IF EXIST copylist.txt DEL copylist.txt
        IF EXIST temp\ RMDIR temp /s /q

:MAINMENUBA2MP4
        IF EXIST concatallthese.txt DEL concatallthese.txt
        IF EXIST temp\ RMDIR temp /s /q
        CALL :COUNTFILES >NUL 2>&1
        CALL :DRAWHEADBA2MP4
        CALL :RESETVALUES
        ECHO Please choose one of the following...
        ECHO[
        ECHO 1 - Use ADB to pull your boot animation.
        ECHO[
        ECHO 2 - Convert zips in the folder "bazips"
        ECHO[
        ECHO 3 - Combine videos in bavideos\ into one.
        ECHO[
        ECHO 4 - Exit
        ECHO[
        CHOICE /C:1234
                IF ERRORLEVEL 1 SET K=1
                IF ERRORLEVEL 2 SET K=2
                IF ERRORLEVEL 3 SET K=3
                IF ERRORLEVEL 4 SET K=4
                IF %K%==1 (CALL :GETBA
                        CALL :UNZIP "%savename%.zip"
                        CALL :CONVERTDESC
                        CALL :GETEXT                       
                        CALL :CHECKSETTINGS
                        CALL :COPYREPEATEDFRAMES >NUL 2>&1
                        CALL :MAKEVIDEO
                        GOTO :MAINMENUBA2MP4)
                IF %K%==2 CALL :BAZIPSFOLDER
                IF %K%==3 CALL :CONCATALL
                IF %K%==4 GOTO :FINISH
        GOTO :MAINMENUBA2MP4

:BAZIPSFOLDER
        IF %filesinbaz% LSS 1 GOTO :EOF
        SETLOCAL ENABLEDELAYEDEXPANSION
        SET /a index=1
        FOR /F "delims=" %%E IN ('dir bazips\ /a-d-h /b *.zip') DO (
                SET "zipfile[!index!]=%%E"
                SET /a index+=1
                )
        If "%index%"=="1" (ECHO There aren't any files in bavideos\
                PAUSE
                GOTO :EOF)
        SET /a themost=index-1
        IF NOT DEFINED debugmode MODE CON:COLS=57 LINES=200
        FOR /l %%I in (1,1,%themost%) DO ECHO %%I. !zipfile[%%I]!
        ECHO[
        ECHO _________________________________________________________       
  :LOOPBACK
        SET /p pickazip=Number?
        IF "%pickazip%"=="" GOTO :LOOPBACK
        IF %pickazip% LSS 1 GOTO :LOOPBACK
        IF %pickazip% GTR %themost% GOTO :LOOPBACK
        SET savename=!zipfile[%pickazip%]!
        IF NOT DEFINED debugmode MODE CON:COLS=57 LINES=60
        CALL :UNZIP "bazips\%savename%"
        SET savename=%savename:.zip=%
        SET savename=%savename:(=%
        SET savename=%savename:)=%
        SET savename=%savename: =%
        SET savename=%savename:&=%
        CALL :CONVERTDESC       
        CALL :GETEXT
        CALL :CHECKSETTINGS
        CALL :COPYREPEATEDFRAMES>NUL 2>&1
        CALL :MAKEVIDEO
       
GOTO :MAINMENUBA2MP4

:RESETVALUES
        SET append=
        SET "savename=bootanimation"
        SET outputtogif=
        SET gif=
        SET strang=
        SET width=
        SET height=
        SET fps=
        SET fpsout=
        SET folder1=
        SET folder2=
        SET folder3=
        SET folder4=
        SET folder5=
        SET folder6=
        SET folder1r=
        SET folder2r=
        SET folder3r=
        SET folder4r=
        SET folder5r=
        SET folder6r=
        SET repeat1=
        SET repeat2=
        SET repeat3=
        SET repeat4=
        SET repeat5=
        SET repeat6=
GOTO :EOF

:DRAWSETTINGS
        ECHO Resolution: %width%X%height% @ %fps%fps in and %fpsout%fps out
        ECHO _________________________________________________________
        ECHO        PLAYS        LAST FRAME
        ECHO        FOLDER        TIMES        PAUSE in frames
        ECHO _________________________________________________________
        IF DEFINED folder1 ECHO %folder1%        %folder1r%        %repeat1%
        IF DEFINED folder2 ECHO %folder2%        %folder2r%        %repeat2%
        IF DEFINED folder3 ECHO %folder3%        %folder3r%        %repeat3%
        IF DEFINED folder4 ECHO %folder4%        %folder4r%        %repeat4%
        IF DEFINED folder5 ECHO %folder5%        %folder5r%        %repeat5%
        IF DEFINED folder6 ECHO %folder6%        %folder6r%        %repeat6%
        ECHO _________________________________________________________
        ECHO FFmpeg quality is set at %quality% on a scale of 0 to 51
        ECHO with 0 being the best quality...       
        ECHO _________________________________________________________       
GOTO :EOF

:YOURSETTINGS
        CALL :DRAWHEADBA2MP4
        CALL :DRAWSETTINGS
        ECHO Please choose one of the following...
        ECHO[
        ECHO 1 - Change the resolution.
        ECHO[
        ECHO 2 - Change the fps.
        ECHO[
        ECHO 3 - Change compression level.
        ECHO[
        ECHO 4 - Continue, and make %videotype%.
        ECHO[
        ECHO 5 - Continue, and make %videotype% ^& gif.
        ECHO[
        ECHO 6 - Exit
        ECHO[
        CHOICE /C:123456
                IF ERRORLEVEL 1 SET K=1
                IF ERRORLEVEL 2 SET K=2
                IF ERRORLEVEL 3 SET K=3
                IF ERRORLEVEL 4 SET K=4
                IF ERRORLEVEL 5 SET K=5
                IF ERRORLEVEL 6 SET K=6
                IF %K%==1 (CALL :CHANGERES
                        CALL :YOURSETTINGS)
                IF %K%==2 (CALL :CHANGEFPS
                        CALL :YOURSETTINGS)
                IF %K%==3 (CALL :CHANGECRF
                        CALL :YOURSETTINGS)
                IF %K%==4 GOTO :EOF
                IF %K%==5 (SET "gif=true"
                        GOTO :EOF)
                IF %K%==6 GOTO :FINISH

GOTO :EOF

:CHANGECRF
        CALL :DRAWHEADBA2MP4
        CALL :DRAWSETTINGS
        ECHO _________________________________________________________
        ECHO The default crf value is 23.  You can set it all the way
        ECHO to 0 for lossless compression.  Your video player more
        ECHO than likely won't even play it.  Youtube will though!
        ECHO _________________________________________________________
        ECHO[
        SET /p crf=What quality (0-51)?
        SET "quality=%quality:~0,5%%crf%"
GOTO :EOF

:CHANGEFPS
        CALL :DRAWHEADBA2MP4
        CALL :DRAWSETTINGS
        ECHO _________________________________________________________
        ECHO[
        ECHO Please keep your fps in, either the same, or half of your
        ECHO[
        ECHO outgoing fps.  If you set your incoming fps at 30 and
        ECHO[
        ECHO your outgoing fps at 40, then some frames may be dropped
        ECHO[
        ECHO and some frames may be copied.  It can mess with timing.
        ECHO _________________________________________________________       
        ECHO[
        SET /P fps=Enter your inbound fps?
        ECHO[
        SET /P fpsout=Enter your outbound fps?
        ECHO[
GOTO :EOF

:CHANGERES
        CALL :DRAWHEADBA2MP4
        CALL :DRAWSETTINGS
        ECHO _________________________________________________________
        ECHO[
        ECHO Some boot animations have a very narrow height.  A mp4
        ECHO[
        ECHO may turn out corrupt because of this.  If you have an
        ECHO[
        ECHO issue with a boot animation of this type, add 100 pixels
        ECHO[
        ECHO or so to the HEIGHT. 
        ECHO _________________________________________________________
        ECHO[
        SET /P width=Enter the width?
        ECHO[
        SET /P height=Enter the height?
        ECHO[
GOTO :EOF
       
       
:GETBA
        SET "androidfolder=/data/local/"
        IF EXIST temp\ RMDIR temp /s /q
        CALL :DRAWHEADBA2MP4
        ECHO _________________________________________________________
        ECHO The default location to get your bootanimation.zip is
        ECHO %androidfolder%
        ECHO _________________________________________________________
        ECHO[
        ECHO Please choose one of the following...
        ECHO[
        ECHO 1 - Pull bootanimation.zip from /data/local/
        ECHO[
        ECHO 2 - Specify a different location.
        ECHO[
        ECHO 3 - Specify a different filename ^& location.
        ECHO[
        ECHO 4 - Go back to the main menu.
        ECHO[
        ECHO 5 - Exit
        ECHO[
        ECHO[
        CHOICE /C:12345
                IF ERRORLEVEL 1 SET K=1
                IF ERRORLEVEL 2 SET K=2
                IF ERRORLEVEL 3 SET K=3
                IF ERRORLEVEL 4 SET K=4
                IF ERRORLEVEL 5 SET K=5
                IF %K%==1 (SET "androidfolder=/data/local/"
                        SET "savename=bootanimation"
                        CALL :PULLBA
                        GOTO :EOF)
                IF %K%==2 CALL :NEWFOLDER
                IF %K%==3 CALL :NEWFOLDERANDFILE
                IF %K%==4 GOTO :MAINMENUBA2MP4
                IF %K%==5 GOTO :FINISH
                SET "androidfolder=/data/local/"
GOTO :EOF       

:NEWFOLDER
        CALL :DRAWHEADBA2MP4
        ECHO[
        ECHO Enter the location in the format of /folder/folder/
        ECHO OR /folder/
        ECHO[
        SET /P androidfolder=:
        SET "savename=bootanimation"
        CALL :PULLBA
GOTO :EOF

:NEWFOLDERANDFILE
        CALL :DRAWHEADBA2MP4
        ECHO[
        ECHO Enter the location in the format of /folder/folder/
        ECHO OR /folder/
        ECHO[
        SET /P androidfolder=:
        ECHO[
        ECHO Enter the name of the zip file.
        ECHO[
        SET /P savename=:
        SET savename=%savename:.zip=%
        CALL :PULLBA
GOTO :EOF
:PULLBA
        ADB kill-server -d >NUL 2>&1
        ECHO[
        ECHO[
        ADB pull %androidfolder%%savename%.zip %savename%.zip >NUL 2>&1
        IF ERRORLEVEL 1 (cls
                ECHO[
                ECHO THERE WAS AN ERROR!
                ECHO[
                ECHO Either %savename%.zip wasn't in %androidfolder%
                ECHO[
                ECHO OR....
                ECHO ______________________________________________________
                ECHO Adb is not properly connected.
                ECHO[
                ECHO Try "Safely Removing" your device from your computer
                ECHO[
                ECHO Then unplug your usb cable, and reinsert it.
                ECHO ______________________________________________________
                ECHO[
                ECHO[
                ECHO Press any key to try again.
                ECHO[
                ECHO[
                PAUSE >NUL
                GOTO :GETBA
        )
GOTO :EOF
       
:DRAWHEADBA2MP4
        CLS
        ECHO[
        ECHO ______________________________________________________-_-       
        ECHO[
        ECHO                Boot Animation to Mp4 v%vers%
        ECHO[
        ECHO _________________________________________________________
        ECHO[
        ECHO                  Written by makers_mark
        ECHO[
        ECHO _________________________________________________________
        ECHO[
GOTO :EOF

:CONVERTDESC
        SETLOCAL EnableDelayedExpansion
                FOR /F "tokens=* delims= " %%X IN (temp\desc.txt) DO SET desc2string=!desc2string! %%X
                ECHO %desc2string% > temp\desc.tmp
        ENDLOCAL
        FOR /F "tokens=1-3 delims= " %%A IN (temp\desc.tmp) DO CALL :WXHFPS %%A %%B %%C
        FOR /F "tokens=7,11,15,19,23,27,31,35,39 delims= " %%A IN (temp\desc.tmp) DO CALL :YOURFOLDERSARE %%A %%B %%C %%D %%E %%F %%G
        FOR /F "tokens=5,9,13,17,21,25,29,33,37 delims= " %%A IN (temp\desc.tmp) DO CALL :YOURFOLDERREPEATSARE %%A %%B %%C %%D %%E %%F %%G
        FOR /F "tokens=6,10,14,18,22,26,30,34,38 delims= " %%A IN (temp\desc.tmp) DO CALL :YOURLASTFRAMEREPEATSARE %%A %%B %%C %%D %%E %%F %%G
        SET "folderlist=%folder1% %folder2% %folder3% %folder4% %folder5% %folder6% %folder7% %folder8% %folder9%"
GOTO :EOF

:COPYREPEATEDFRAMES
        IF NOT DEFINED repeat1 GOTO :EOF
                IF %repeat1% GEQ 1 (
                        FOR /F "delims=" %%A IN ('dir "temp\%folder1%\*.%ext%" /a-d-h /on /b') DO SET "filetocopy=%%A")
                        FOR /L %%Y IN (1,1,%repeat1%) DO COPY temp\%folder1%\%filetocopy% temp\%folder1%\z%%Y%filetocopy%
                        )
        IF NOT DEFINED repeat2 GOTO :EOF
                IF %repeat2% GEQ 1 (
                        FOR /F "delims=" %%A IN ('dir "temp\%folder2%\*.%ext%" /a-d-h /on /b') DO SET "filetocopy=%%A")
                        FOR /L %%Y IN (1,1,%repeat2%) DO COPY temp\%folder2%\%filetocopy% temp\%folder2%\z%%Y%filetocopy%
                        )
        IF NOT DEFINED repeat3 GOTO :EOF
                IF %repeat3% GEQ 1 (
                        FOR /F "delims=" %%A IN ('dir "temp\%folder3%\*.%ext%" /a-d-h /on /b') DO SET "filetocopy=%%A")
                        FOR /L %%Y IN (1,1,%repeat3%) DO COPY temp\%folder3%\%filetocopy% temp\%folder3%\z%%Y%filetocopy%
                        )       
        IF NOT DEFINED repeat4 GOTO :EOF
                IF %repeat4% GEQ 1 (
                        FOR /F "delims=" %%A IN ('dir "temp\%folder4%\*.%ext%" /a-d-h /on /b') DO SET "filetocopy=%%A")
                        FOR /L %%Y IN (1,1,%repeat4%) DO COPY temp\%folder2%\%filetocopy% temp\%folder4%\z%%Y%filetocopy%
                        )       
        IF NOT DEFINED repeat5 GOTO :EOF
                IF %repeat5% GEQ 1 (
                        FOR /F "delims=" %%A IN ('dir "temp\%folder5%\*.%ext%" /a-d-h /on /b') DO SET "filetocopy=%%A")
                        FOR /L %%Y IN (1,1,%repeat5%) DO COPY temp\%folder5%\%filetocopy% temp\%folder5%\z%%Y%filetocopy%
                        )       
        IF NOT DEFINED repeat6 GOTO :EOF
                IF %repeat6% GEQ 1 (
                        FOR /F "delims=" %%A IN ('dir "temp\%folder6%\*.%ext%" /a-d-h /on /b') DO SET "filetocopy=%%A")
                        FOR /L %%Y IN (1,1,%repeat6%) DO COPY temp\%folder6%\%filetocopy% temp\%folder6%\z%%Y%filetocopy%
                        )
GOTO :EOF

:CHECKSETTINGS
        CALL :DRAWSETTINGS       
        ECHO _________________________________________________________
        ECHO The root of your save name for the video is:
        ECHO "%savename%"
        ECHO _________________________________________________________
        IF NOT EXIST %savefolder%\ MKDIR %savefolder%\
        ECHO[
        ECHO  1 - Continue with the conversion.
        ECHO[
        ECHO  2 - Continue with conversion ^& make gif also.
        ECHO[
        ECHO  3 - Change resolution, frame rate, or compression...
        ECHO[
        ECHO  4 - Go to the Main Menu
        ECHO[
        ECHO  5 - Exit
        ECHO[
        CHOICE /C:12345
                IF ERRORLEVEL 1 SET K=1
                IF ERRORLEVEL 2 SET K=2
                IF ERRORLEVEL 3 SET K=3
                IF ERRORLEVEL 4 SET K=4
                IF ERRORLEVEL 5 SET K=5
                IF %K%==1 GOTO :EOF
                IF %K%==2 (SET gif=1
                        GOTO :EOF)
                IF %K%==3 (CALL :YOURSETTINGS
                        GOTO :EOF)
                IF %K%==4 GOTO :MAINMENUBA2MP4
                IF %K%==5 GOTO :FINISH
GOTO :EOF

:MAKEVIDEO
        CALL :NAMEPREFIX
        IF DEFINED gif SET "outputtogif=-y %savefolder%\%savename%.gif"
        CALL :DRAWHEADBA2MP4
        ECHO The last folder is going to play at least once and wait 
        ECHO[
        ECHO for your device to boot while playing over and over. 
        ECHO[
        ECHO How many extra repeats do you want to record to
        ECHO[
        ECHO simulate waiting for boot?
        ECHO _________________________________________________________
        SET /P repeatlast=:
        ECHO[
        ECHO _________________________________________________________
        ECHO Renumbering the %ext%s.
        FOR /D %%B IN (%folderlist%) DO CALL :RENUM %%B %ext% >NUL 2>&1
        FOR /D %%C IN (%folderlist%) DO SET "lastfolder=%%C" >NUL 2>&1
        ECHO Converting %ext%s to an %videotype% video.
        FOR /D %%A IN (%folderlist%) DO (CALL FFMPEG %ffdebug% %ffshowb% %stno% %stnorng% -f image2 -r %fps% -i temp\%%A\%%%%08d.%ext% -tune stillimage -c:v libx264 -s %width%x%height% -vf "fps=%fpsout%, format=yuv420p" %quality% -y "temp\%%A\%savename%%%A.%videotype%"
                ECHO Processed the folder %%A
                ECHO file temp\\%%A\\%savename%%%A.%videotype%>>copylist.txt
        )
        ECHO _________________________________________________________       
        FOR /L %%E IN (1,1,%repeatlast%) DO ECHO file temp\\%lastfolder%\\%savename%%lastfolder%.%videotype%>>copylist.txt
        ECHO Concatenating the %videotype%s...
        IF DEFINED outputtogif ECHO And preparing the gif...
        FFMPEG %ffdebug% %ffshowb% -f concat -i copylist.txt -vcodec copy -y %savefolder%\%savename%.%videotype% %outputtogif%
        CALL :DRAWHEADBA2MP4
        ECHO _________________________________________________________       
        ECHO[
        ECHO[
        ECHO DONE!!!!
        ECHO[
        ECHO Video saved as:
        ECHO _________________________________________________________
        ECHO %savefolder%\%savename%.%videotype%
        ECHO _________________________________________________________
        IF DEFINED outputtogif (
                ECHO Gif saved as:
                ECHO _________________________________________________________
                ECHO %savefolder%\%savename%.gif
                ECHO _________________________________________________________
        )
        CALL :RESETVALUES
        ECHO[
        ECHO[
        ECHO All temporary files including individual videos for each
        ECHO[
        ECHO folder in the zip, will be deleted upon continuing!!!!
        ECHO[
        ECHO Your zip file that was used was moved, untouched, to the
        ECHO[
        ECHO folder bazips\......
        ECHO[
        ECHO[
        ECHO Hit any key to continue.
        ECHO[
        ECHO[
        PAUSE >NUL
        DEL copylist.txt
        RMDIR temp /s /q
GOTO :EOF

:CONCATALL
        IF %filesinbav% LSS 1 GOTO :EOF       
        IF EXIST concatallthese.txt DEL concatallthese.txt
        CALL :DRAWHEADBA2MP4
        ECHO[
        ECHO _________________________________________________________

        ECHO This will put all videos together that are currently in
        ECHO[
        ECHO the folder bavideos\  You might experience errors with
        ECHO[
        ECHO the video or no video produced if the resolutions are
        ECHO[
        ECHO different on a video to video comparison basis.
        ECHO _________________________________________________________
        ECHO I highly recommend you to hit option 2 to only use
        ECHO[
        ECHO %videotype%'s that share a common string in the name.
        ECHO _________________________________________________________
        ECHO[
        ECHO 1 - Concatenate ALL videos
        ECHO[
        ECHO 2 - Concatenate videos that have a common string in name
        ECHO[
        ECHO 3 - Go back to the main menu
        ECHO[
        ECHO 4 - Exit
        ECHO[
        CHOICE /C:1234
                IF ERRORLEVEL 1 SET K=1
                IF ERRORLEVEL 2 SET K=2
                IF ERRORLEVEL 3 SET K=3
                IF ERRORLEVEL 4 SET K=4
                IF %K%==1 CALL :ALL
                IF %K%==2 CALL :SOME
                IF %K%==3 GOTO :MAINMENUBA2MP4
                IF %K%==4 GOTO :FINISH
       
        CALL :NAMECONCATALL
        FFMPEG %ffdebug% %ffshowb% -f concat -i concatallthese.txt -vcodec copy -y %savefolder%\%savename%.%videotype%
        IF ERRORLEVEL 1 ECHO There was no match to your search: %strang% & PAUSE & IF NOT DEFINED debugmode (MODE CON:COLS=57 LINES=60) & GOTO :EOF
        IF ERRORLEVEL 0 ECHO Saved as:%savefolder%\%savename%.%videotype% & PAUSE & IF NOT DEFINED debugmode (MODE CON:COLS=57 LINES=60) & GOTO :EOF
        IF EXIST concatallthese.txt DEL concatallthese.txt
GOTO :EOF

:SOME
        SET strang=
        CALL :DRAWHEADBA2MP4
        SETLOCAL ENABLEDELAYEDEXPANSION
        SET /a index=1
        FOR /F %%E in ('dir %savefolder%\*.%videotype% /a-d-h /b') DO (
                SET "videofile[!index!]=%%E"
                SET /a index+=1
                )
        SET /a themost=index-1

        IF NOT DEFINED debugmode MODE CON:COLS=57 LINES=200
        ECHO _________________________________________________________
        FOR /l %%I in (1,1,%themost%) DO ECHO !videofile[%%I]!
        ECHO _________________________________________________________
        ENDLOCAL
        ECHO[
        ECHO Please enter a search string.  I will put together all
        ECHO[
        ECHO the files that contain whatever you type.  Don't mix
        ECHO[
        ECHO files with different compression settings, and in some
        ECHO[
        ECHO cases resolutions.  The compression setting value for
        ECHO[
        ECHO each file can be found right after the name of the
        ECHO[
        ECHO original zip ^& and before the time stamp at the end of
        ECHO[
        ECHO the file name.  Default is 23.
        ECHO[
        ECHO An idea for a search string is the resolution...
        ECHO or the crf value.....
        ECHO[
        SET /P strang=:
        ECHO[

        FOR /F %%E IN ('dir %savefolder%\*.%videotype% /a-d-h /b^|findstr /rmic:"%strang%"') DO (ECHO file %savefolder%\\%%E>>concatallthese.txt
                ECHO %savefolder%\%%E  Added.
                )
        ECHO _________________________________________________________               
GOTO :EOF

:ALL
        FOR /F %%E IN ('dir %savefolder%\*.%videotype% /a-d-h /b') DO (ECHO file %savefolder%\\%%E>>concatallthese.txt
                ECHO %savefolder%\%%E  Added.
                )
        ECHO _________________________________________________________               
GOTO :EOF
       
:YOURFOLDERSARE
        SET "folder1=%1"
        IF [%2]==[] GOTO :EOF
        SET "folder2=%2"
        IF [%3]==[] GOTO :EOF
        SET "folder3=%3"
        IF [%4]==[] GOTO :EOF
        SET "folder4=%4"
        IF [%5]==[] GOTO :EOF
        SET "folder5=%5"
        IF [%6]==[] GOTO :EOF
        SET "folder6=%6"
        IF [%7]==[] GOTO :EOF
        SET "folder7=%7"
        IF [%8]==[] GOTO :EOF
        SET "folder8=%8"
        IF [%9]==[] GOTO :EOF
        SET "folder9=%9"
GOTO :EOF

:YOURLASTFRAMEREPEATSARE
        SET repeat1=%1
        IF [%2]==[] GOTO :EOF
        SET repeat2=%2
        IF [%3]==[] GOTO :EOF
        SET repeat3=%3
        IF [%4]==[] GOTO :EOF
        SET repeat4=%4
        IF [%5]==[] GOTO :EOF
        SET repeat5=%5
        IF [%6]==[] GOTO :EOF
        SET repeat6=%6
        IF [%7]==[] GOTO :EOF
        SET repeat7=%7
        IF [%8]==[] GOTO :EOF
        SET repeat8=%8
        IF [%9]==[] GOTO :EOF
        SET repeat9=%9
GOTO :EOF
               
:YOURFOLDERREPEATSARE
        SET folder1r=%1
        IF [%2]==[] GOTO :EOF
        SET folder2r=%2
        IF [%3]==[] GOTO :EOF
        SET folder3r=%3
        IF [%4]==[] GOTO :EOF
        SET folder4r=%4
        IF [%5]==[] GOTO :EOF
        SET folder5r=%5
        IF [%6]==[] GOTO :EOF
        SET folder6r=%6
        IF [%7]==[] GOTO :EOF
        SET folder7r=%7
        IF [%8]==[] GOTO :EOF
        SET folder8r=%8
        IF [%9]==[] GOTO :EOF
        SET folder9r=%9       
GOTO :EOF

:WXHFPS
        SET width=%1
        SET height=%2
        SET fps=%3
        SET fpsout=%fps%
GOTO :EOF

:GETEXT
        FOR %%f IN (temp\%folder1%\*.*) DO set "t=%%f"
        SET "ext=%t:~-3%
GOTO :EOF
       
:RENUM
        SETLOCAL ENABLEDELAYEDEXPANSION
        SET "index=00000000"
        SET /A Q=1%index%
        FOR /F "delims=" %%a IN ('dir temp\%1/a-d-h /b *.%~2^|findstr /rxvc:"......[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\.%~2"') DO (
                SET /a Q+=1
                SET "name=%%~na"
                REN "temp\%~1\%%~a" "!Q:~-8!%%~xa"
        )
        ENDLOCAL
GOTO :EOF

:UNZIP
        IF NOT EXIST temp\ MKDIR temp\
        CALL :DRAWHEADBA2MP4
        7ZA -y x %1 -o"%~dp0temp" >NUL 2>&1
        IF NOT EXIST bazips\ MKDIR bazips\
        MOVE %~1 bazips\%~1 >NUL 2>&1
GOTO :EOF

:NAMECONCATALL
        SET savename=%TIME::=_%
        SET savename=%savename:.=%
        SET savename=all%savename: =%
        IF %K%==2 SET savename=%savename%_%strang%
GOTO :EOF

:COUNTFILES
        FOR /f %%A in ('dir bavideos\*.%videotype% /a-d-s-h /b ^| find /v /c ""') do set /a filesinbav=%%A        >NUL 2>&1
        FOR /f %%A in ('dir bazips\*.zip /a-d-s-h /b ^| find /v /c ""') do set /a filesinbaz=%%A >NUL 2>&1

GOTO :EOF
:NAMEPREFIX
        SET append=%TIME::=_%
        SET append=%append:.=%
        SET append=_crf%quality:~-2%_%append%
        SET append=%append: =%
        SET savename=%fps%_%fpsout%_%width%X%height%_%savename%%append%
GOTO :EOF

:FINISH
        ADB kill-server -d >NUL 2>&1
        IF EXIST temp\ RMDIR temp /s /q
EXIT


Viewing all articles
Browse latest Browse all 4090

Trending Articles