Post Reply

[TOOL][WIN][v1.86b][Updated]Bootanimation.zip to Mp4 Video and converter/porter

OP makers_mark

16th February 2014, 11:45 PM   |  #1  
makers_mark's Avatar
OP Member
Flag Kings Mountain
Thanks Meter: 147
 
98 posts
Join Date:Joined: Sep 2013
More
This is a Windows tool that will convert your bootanimation.zip into a Mp4 video.

This is a Boot Animation emulator, it unzips the zip file then takes information from the desc.txt file, and does what android would do with all of the images and folders. You can either pull your bootanimation file from your device with this program, or put bootanimation zip files in the "zips" folder that gets created first time you run this program.

This is ideal for making Youtube videos as it takes every detail from your bootanimation file, and uses it like android would. If an image is called to pause for 25 frames after a part has played, then replay the folder with a 3 frame pause, it will. You may also play with framerates, and resolutions.

Videos made can also be strung together in the program through a search of a string in the video name, ie resolution, or you can concatenate all of them.
Updated March 23rd, 2014
V1.86b
-Added support for Mp4 style boot animations
-Added quickport, where you can easily change the resolution of a bootanimation zip
-Added a converter to go from a Jpg/Png style bootanimation to Mp4 style or vice versa
-Changed all file/folder location references to full paths for speed, and reliability
-Added logging to help troubleshoot any issues that may arise
-Added an option to scale Gifs to a different size
Click the button below for an explanation of what I do, and see exactly how the process works.

When you load a zip file, it is automatically unzipped, and searched for a desc.txt file in the root directory. It moves the zipped file, if it was pulled from your device, into the "zips" folder. It then reads your desc.txt file and finds the first line that starts with a number. That will be your resolution and framerate. Then it gets the rest of the folder information for putting the animation together. I never alter your actual bootanimation file.

Most bootanimations have something similar to this in their last line: p 0 0 part6 That first 0 after the p indicates to android, to play continuously until the device OS is loaded. Some have a: c 0 0 part6 This is almost the same thing, but it will play at least once, and it will play all of the way through the animation of part6, no matter what the boot status is of your device.
Since we a making a video out of all this, we have to simulate boot. So if you have any parts with the 0 immediately after the p or c, then you will be prompted to input how many times you want that folder to loop for the video.

You are ready to make a video now. This is where the complexity of the whole process happens. You don't have to worry about it though. Some folders of images will have a pause frame at the end of the part, so I copy that image X number of times, renumber all the files, make the video for that part, and trim the files back to the original images. The video is then saved in a temp folder as the rest of the videos are made for each folder call, using the same process, which actually may be different (it all depends on what the desc.txt file calls for). At the end, the different videos are concatenated together, with folder repeats included, to form the final video and or Gif.

This happens a lot quicker than it sounds!

I am not responsible if you brick your phone or fry your computer. Always make backups!
Download Bootanimation to Mp4 v1.86b
This rar archive contains the programs:
ADB - Used to communicate between your computer and device
7ZA - Used to zip and unzip the boot animation zip files
FFMPEG - Used to convert media from one type to another

It also contains two dll files for ADB. These five files are in the 'bin' folder in the download. The last file included is the batch script named RUNba2mp4v186b.bat. Run this file.

The batch file can be found in these two posts #22 and #23 in this thread:
Part 1 of 2
Part 2 of 2
Some versions of Windows (particularly XP and/or Win2k) dropped support for the choice command for a couple of years then picked it back up. I use the choice command extensively for my menus. Ba2mp4 will not work without this command. To see if you have choice, you can simply open up a command prompt window anywhere, and type "choice"
- If you are prompted with [Y,N]? then you have the choice command and are good to go.
- If you see 'choice' is not recognized as an internal or external command..... then you don't have it.
You can download choice.com or choice.exe from a number of websites. If you are unsure of what to download feel free to pm me and I will help you out, or make a version that will work for you. Please don't download an executable program from an untrusted site, you could do serious damage to your computer and/or your past, present, and future data can all be compromised. There are too many trusted sites for me to list with different versions for different operating systems.

If you experience a video that looks messed up:
Almost every time this happens, it is because your computer can not keep up with the huge amounts of data streams some of the higher resolution boot animations can create. You can usually tell if it is your computer or the video file by simply letting it play one time, then let it loop back and replay the video, and all of the sudden everything is smooth. If you upload it to Youtube it will play perfect. If you play the video on a nicer computer, it will play perfect. lol You may set the compression level a little lower if you are just making a video for yourself on your computer.
This guy is a really good animator. I doubled the resolution on this one, and set the end to repeat 6 times. This animation was done by @overhauling and can be found here!



I did not make this bootanimation, or any of these, just the videos. 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. 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 "videos" 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.



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
v1.6 2/21/14
Added support for endless folders, repeats
Fixed error for using jpgs in one folder and pngs in another
Tightened up code making the video to make it faster
Added frame counters and timing indicators
v1.61 2/22/14
Reduced calls in loops surrounding/in video processing
Added Gifs folder for ... gifs
Added check in system\media in case zip file is a flashable zip
Added a check in # of zip files to know whether to expand window or not that displays them
v1.86b 3/23/14
Added support for Mp4 style boot animations
Added quickport, where you can easily change the resolution of a bootanimation zip
Added a converter to go from a Jpg/Png style bootanimation to Mp4 style or vice versa
Changed all file/folder location references to full paths for speed, and reliability
Added logging to help troubleshoot any issues that may arise
Added an option to scale Gifs to a different size
Last edited by makers_mark; 24th March 2014 at 03:05 AM. Reason: updated
The Following 11 Users Say Thank You to makers_mark For This Useful Post: [ View ]
21st February 2014, 05:31 AM   |  #2  
makers_mark's Avatar
OP Member
Flag Kings Mountain
Thanks Meter: 147
 
98 posts
Join Date:Joined: Sep 2013
More
Click the button below for the batch script:
Code:
@ECHO OFF

SETLOCAL ENABLEDELAYEDEXPANSION

	MODE CON:COLS=57 LINES=80
	color 0B
	SET "vers=1.61"
	TITLE Boot Animation to Mp4 v%vers%
	SET /A colines=80
	SET "outputtogif="
	SET "androidfolder=/data/local/"
	SET "savefolder=videos"
	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=4000
		COLOR 07
	)
	IF NOT EXIST gifs MKDIR gifs
	IF NOT EXIST zips MKDIR zips
	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 "zips"
	ECHO[
	ECHO 3 - Combine videos in "videos" 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 GOTO :ADBTOGETIT
		IF %K%==2 GOTO :BAZIPSFOLDER
		IF %K%==3 GOTO :CONCATALL
		IF %K%==4 GOTO :FINISH
	GOTO :MAINMENUBA2MP4

:ADBTOGETIT
	CALL :GETBA
	CALL :UNZIP "%savename%.zip"
	SET "filename=%savename%.zip"
	CALL :STRIP
	CALL :READDESC
	GOTO :YOURSETTINGS
GOTO :MAINMENUBA2MP4

:BAZIPSFOLDER
	IF %filesinbaz% LSS 1 GOTO :MAINMENUBA2MP4
	SET /a index=1
	FOR /F "delims=" %%E IN ('dir zips\ /a-d-h /b *.zip') DO (
		SET "zipfile[!index!]=%%E"
		SET /a index+=1
		)
	SET /A themost=index-1
	IF %themost% GTR 72 SET /A colines=%themost% + 10
	IF NOT DEFINED debugmode MODE CON:COLS=57 LINES=%colines%
	FOR /l %%I in (1,1,%themost%) DO ECHO %%I. !zipfile[%%I]!
	ECHO[
	ECHO _________________________________________________________
	ECHO[
	ECHO Choose a number and press enter...
	ECHO[
  :LOOPBACK
	SET /p pickazip=:
	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=80
	CALL :UNZIP "zips\%savename%"
	SET "filename=%savename%"
	CALL :STRIP
	CALL :READDESC	
GOTO :YOURSETTINGS

:STRIP
	SET savename=%savename:.zip=%
	SET savename=%savename:(=%
	SET savename=%savename:)=%
	SET savename=%savename: =%
	SET savename=%savename:&=%
GOTO :EOF

:RESETVALUES
	SET append=
	SET "savename=bootanimation"
	SET outputtogif=
	SET gif=
	SET strang=
	SET width=
	SET height=
	SET fps=
	SET fpsout=
GOTO :EOF

:FILLTHEVOID
	CALL :DRAWSETTINGS
	ECHO[
	ECHO[
	ECHO[
	ECHO When you have a 'p'with'0' as the first number on a line
	ECHO Android will play the folder until booted.  Since there
	ECHO will not be a boot, you need to enter how many times you
	ECHO want this folder to loop for the video.  A "c" then "0"
	ECHO is a little different, but if you have a 'c' then '0'
	ECHO I would still need a loop value for the video.
	ECHO _________________________________________________________
	ECHO[
	ECHO[
	ECHO[
:LOOP2
	FOR /L %%P IN (1,1,%staticfoldercount$%) DO (
		IF !folderrepeats[%%P]! EQU 0 (
			SET /A secondsperloop[%%P]=!frames[%%P]!/%fps% >NUL 2>&1
			SET /A secondsperlooprem[%%P]=!frames[%%P]!%%%fps% >NUL 2>&1
			ECHO[
			ECHO FOLDER %%P: !folder[%%P]! NEEDS A VALUE TO LOOP FOR VIDEO
			ECHO[
			ECHO One loop of this folder will last !secondsperloop[%%P]! !secondsperlooprem[%%P]!/%fps% seconds
			ECHO[
			SET /P folderrepeats[%%P]=:
			IF "!folderrepeats[%%P]!"=="" GOTO :LOOP2
			IF !folderrepeats[%%P]! LSS 1 GOTO :LOOP2
			ECHO[
		)
	)
GOTO :EOF

:DRAWSETTINGS
	CLS
	ECHO[
	ECHO File:%filename%
	ECHO ______________________________________________________-_-
	FOR /l %%z IN (1,1,%staticfoldercount$%) DO (
		SET /A totalwithrepeats[%%z]=!frames[%%z]!*!folderrepeats[%%z]!
		SET /A stime[%%z]=!totalwithrepeats[%%z]!/%fps% >NUL 2>&1
		SET /A dtime[%%z]=!totalwithrepeats[%%z]!%%%fps% >NUL 2>&1
		ECHO %%z: !foldertype[%%z]!	!folderrepeats[%%z]!	!pauselastframe[%%z]!	!folder[%%z]!
	)
	ECHO _________________________________________________________
	FOR /l %%M IN (1,1,%staticfoldercount$%) DO ECHO !folder[%%M]!	Frames: !frames[%%M]! x !folderrepeats[%%M]!	Length: !stime[%%M]! !dtime[%%M]!/%fps% seconds
	ECHO _________________________________________________________
	SET /A grandtotal=0
	FOR /L %%R IN (1,1,%staticfoldercount$%) DO SET /A grandtotal=!grandtotal!+!totalwithrepeats[%%R]!
	ECHO Total frames:	%grandtotal%
	SET /A totaltime=%grandtotal% / %fps%
	SET /A fractiontime=%grandtotal%%%%fps
	ECHO Total time:	%totaltime% %fractiontime%/%fps% seconds
	ECHO _________________________________________________________
	ECHO[
	ECHO Resolution: %width%X%height% @ %fps%fps in and %fpsout%fps out
	ECHO[
	ECHO FFmpeg quality is set at %quality% on a scale of 0 to 51
	ECHO _________________________________________________________
GOTO :EOF

:YOURSETTINGS
	CALL :GETEXT 1
	CALL :DRAWSETTINGS
	SET K=
	ECHO[
	ECHO[
	ECHO[
	ECHO[
	ECHO Please choose one of the following...
	ECHO[
	ECHO[
	ECHO[
	ECHO[
	ECHO  1 - Continue, and make %videotype%.
	ECHO[
	ECHO  2 - Continue, and make %videotype% ^& gif.
	ECHO[
	ECHO  3 - Change the video compression level.
	ECHO[
	ECHO  4 - Change the resolution.
	ECHO[
	ECHO  5 - Change the fps.
	ECHO[
	ECHO  6 - Reload desc.txt    ^<^<reset fps/resolution/repeats^<^<
	ECHO[
	ECHO  7 - Go back to the Main Menu
	ECHO[
	ECHO  8 - Exit
	ECHO[
	ECHO[
	ECHO[
	CHOICE /C:12345678
		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 ERRORLEVEL 7 SET K=7
		IF ERRORLEVEL 8 SET K=8
		IF %K%==1 GOTO :LETSDOIT
		IF %K%==2 SET "gif=true" & GOTO :LETSDOIT
		IF %K%==3 CALL :CHANGECRF
		IF %K%==4 CALL :CHANGERES
		IF %K%==5 CALL :CHANGEFPS
		IF %K%==6 CALL :READDESC
		IF %K%==7 GOTO :MAINMENUBA2MP4
		IF %K%==8 GOTO :FINISH
GOTO :YOURSETTINGS

:CHANGECRF
	CALL :DRAWSETTINGS
	ECHO[
	ECHO[
	ECHO[
	ECHO[
	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 _________________________________________________________
:LOOP3
	ECHO[
	SET /p crf=What quality (0-51)?
	IF "%crf%"=="" GOTO :LOOP3
	IF %crf% LSS 0 GOTO :LOOP3
	IF %crf% GTR 51 GOTO :LOOP3
	SET "quality=%quality:~0,5%%crf%"
GOTO :EOF

:CHANGEFPS
	CALL :DRAWSETTINGS
	ECHO[
	ECHO[
	ECHO[
	ECHO[	
	ECHO _________________________________________________________
	ECHO[
	ECHO Your inbound fps is what you will see the animation being
	ECHO[
	ECHO rendered at.  Your outbound fps is how many fps the video 
	ECHO[
	ECHO will be encoded at.
	ECHO _________________________________________________________	
	ECHO[
	SET /P fps=Enter your inbound fps?
	ECHO[
	SET /P fpsout=Enter your outbound fps?
	ECHO[
GOTO :EOF

:CHANGERES
	CALL :DRAWSETTINGS
	ECHO[
	ECHO[
	ECHO[
	ECHO[	
	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
	)
	SET filename=%savename%.zip
GOTO :EOF
	
:DRAWHEADBA2MP4
	CLS
	ECHO[
	ECHO ______________________________________________________-_-	
	ECHO[
	ECHO               Boot Animation 2 %videotype% v%vers%
	ECHO[
	ECHO _________________________________________________________
	ECHO[
	ECHO                  Written by makers_mark
	ECHO[
	ECHO _________________________________________________________
	ECHO[
GOTO :EOF
	
:READDESC
	SET /a staticfoldercount$=0
	FOR /F "tokens=1-3 delims= " %%L IN ('FINDSTR /I "^[0-9]" "%~dp0temp\desc.txt"') DO CALL :GETRES %%L %%M %%N
	FOR /F "tokens=1-4 delims= " %%L IN ('FINDSTR /I "^P ^C" "%~dp0temp\desc.txt"') DO CALL :FOLDERS %%L %%M %%N %%O
	CALL :FILLTHEVOID
GOTO :EOF

:GETRES
	SET /A width=%1
	SET /A height=%2
	SET /A fps=%3
	SET /A fpsout=%fps%
GOTO :EOF

:FOLDERS
	SET /A staticfoldercount$+=1
	FOR /F %%A in ('dir temp\%~4\*.* /a-d-s-h /b ^| FIND /v /c ""') DO SET /A filesinfolder[%staticfoldercount$%]=%%A
	SET foldertype[%staticfoldercount$%]=%1
	SET /A folderrepeats[%staticfoldercount$%]=%2	
	SET /A pauselastframe[%staticfoldercount$%]=%3
	SET folder[%staticfoldercount$%]=%4
	SET /A frames[%staticfoldercount$%]=!filesinfolder[%staticfoldercount$%]! + !pauselastframe[%staticfoldercount$%]!
	CALL :GETEXT %staticfoldercount$%
GOTO :EOF

:GETEXT
	FOR %%f IN (temp\!folder[%~1]!\*.*) DO SET "ext=%%f"
	SET extinfolder[%~1]=!ext:~-3!
GOTO :EOF

:LETSDOIT
	CALL :DRAWSETTINGS
	ECHO[
	CALL :NAMEPREFIX
	IF DEFINED gif SET "outputtogif=-y gifs\%savename%.gif"	
	SET /A checkheight=%height%%%2
	SET /A checkwidth=%width%%%2
	IF %checkheight% EQU 1 (SET /A height-=1 & ECHO Height has been adjusted 1 pixel)
	IF %checkwidth% EQU 1 (SET /A width-=1	& ECHO Width has been adjusted 1 pixel)
	ECHO Working..
	FOR /L %%A IN (1,1,%staticfoldercount$%) DO (	
		ECHO %%A/!staticfoldercount$!...!folder[%%A]!..........
		IF !pauselastframe[%%A]! GEQ 1 CALL :COPYREPEATEDFRAMES %%A >NUL 2>&1
		CALL :RENUM "!folder[%%A]!" !extinfolder[%%A]! >NUL 2>&1
		FFMPEG %ffdebug% %ffshowb% %stno% %stnorng% -f image2 -r %fps% -i temp\!folder[%%A]!\%%08d.!extinfolder[%%A]! -tune stillimage -c:v libx264 -s %width%x%height% -vf "fps=%fpsout%, format=yuv420p" %quality% -y "temp\buffer\%%A%savename%.%videotype%" || GOTO :FFVIEW
		ECHO !folder[%%A]! complete
		IF !pauselastframe[%%A]! GEQ 1 CALL :TRIMFRAMES %%A >NUL 2>&1
		FOR /L %%J in (1,1,!folderrepeats[%%A]!) DO ECHO file temp\\buffer\\%%A%savename%.%videotype%>>copylist.txt
	)
	IF %checkheight% EQU 1 SET /A height+=1
	IF %checkwidth% EQU 1 SET /A width+=1
	SET checkheight=
	SET checkwidth=
GOTO :FINISHVIDEO

:TRIMFRAMES
	SET /A piks=!filesinfolder[%~1]!
	FOR /F "skip=%piks% eol=: delims=" %%F IN ('dir "temp\!folder[%~1]!\*.!extinfolder[%~1]!" /a-d-h/b /on ') DO DEL temp\!folder[%~1]!\%%F
GOTO :EOF

:COPYREPEATEDFRAMES
	FOR /F "delims=" %%t IN ('dir "temp\!folder[%~1]!\*.!extinfolder[%~1]!" /a-d-h /on /b') DO SET "filetocopy=%%t"
	FOR /L %%Y IN (1,1,!pauselastframe[%~1]!) DO COPY temp\!folder[%~1]!\%filetocopy% temp\!folder[%~1]!\z%%Y%filetocopy%
GOTO :EOF

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

:FINISHVIDEO
	FFMPEG %ffdebug% %ffshowb% -f concat -i copylist.txt -vcodec copy -y %savefolder%\%savename%.%videotype% %outputtogif% || GOTO :FFVIEW
	IF NOT EXIST %savefolder%\%savename%.%videotype% GOTO :FFVIEW
	ECHO ______________________________________________________-_-
	ECHO[
	ECHO \\\\\\\\\\\\\\\\\\\\\\\\\\DONE///////////////////////////
	ECHO[
	ECHO Video saved as:\%savefolder%\
	ECHO %savename%.%videotype%
	IF DEFINED outputtogif (
		ECHO _________________________________________________________	
		ECHO Gif saved as:\gifs\
		ECHO %savename%.gif
		ECHO[
	)	
	ECHO[
	ECHO //////////////////////////DONE\\\\\\\\\\\\\\\\\\\\\\\\\\\
	ECHO _________________________________________________________
	SET "outputtogif="
	SET gif=
	SET "savename=%filename%"
	CALL :STRIP
	ECHO Press a key to continue
	PAUSE >NUL
	DEL /Q temp\buffer\*.%videotype%
	DEL copylist.txt		
GOTO :YOURSETTINGS

:CONCATALL
	IF %filesinbav% LSS 1 GOTO :MAINMENUBA2MP4
	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 videos\  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
GOTO :MAINMENUBA2MP4

:SOME
	SET strang=
	CALL :DRAWHEADBA2MP4
	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
	SET /a linesinsome=%themost% + 40
	IF NOT DEFINED debugmode MODE CON:COLS=57 LINES=%linesinsome%
	ECHO _________________________________________________________
	FOR /l %%I in (1,1,%themost%) DO ECHO !videofile[%%I]!
	ECHO _________________________________________________________

	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 resolution in the
	ECHO[
	ECHO the file name.  Default is crf 23.
	ECHO[
	ECHO An idea for a search string is the resolution...
	ECHO or the crf value.....
	ECHO[
:TRYITAGAIN
	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.%videotype%  Added.
	)
	IF NOT EXIST concatallthese.txt GOTO :TRYITAGAIN
	ECHO _________________________________________________________
	ECHO[
	ECHO These are the files matching: %strang%
	ECHO[
	ECHO 1 - Go back to the main menu
	ECHO[
	ECHO 2 - Continue
	ECHO[
	CHOICE /C:12
		IF ERRORLEVEL 1 SET K=1
		IF ERRORLEVEL 2 SET K=2
		IF %K%==1 (IF NOT DEFINED debugmode (MODE CON:COLS=57 LINES=80)
			GOTO :MAINMENUBA2MP4)	
		IF %K%==2 CALL :NAMECONCATALL %strang%
	CALL :MAKECONCAT
	IF NOT DEFINED debugmode (MODE CON:COLS=57 LINES=80)
GOTO :MAINMENUBA2MP4

:ALL
	FOR /F %%E IN ('dir %savefolder%\*.%videotype% /a-d-h /b') DO (ECHO file %savefolder%\\%%E>>concatallthese.txt
		ECHO %savefolder%\%%E  Added.
		)
	CALL :NAMECONCATALL
	CALL :MAKECONCAT
GOTO :MAINMENUBA2MP4

:MAKECONCAT
	IF NOT EXIST concatallthese.txt GOTO :EOF
	ECHO[
	ECHO _________________________________________________________
	ECHO[
	FFMPEG %ffdebug% %ffshowb% -f concat -i concatallthese.txt -vcodec copy -y %savefolder%\%savename%.%videotype% || GOTO :FFVIEW
	ECHO[
	ECHO Saved as:%savefolder%\%savename%.%videotype%
	PAUSE >NUL	
	IF NOT DEFINED debugmode (MODE CON:COLS=57 LINES=80)
	IF EXIST concatallthese.txt DEL concatallthese.txt
GOTO :MAINMENUBA2MP4
	
:RENUM
	SET "index=00000000"
	SET /A Q=1%index%
	FOR /F "delims=" %%a IN ('dir temp\%~1\*.%~2/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"
	)
GOTO :EOF

:UNZIP
	IF NOT EXIST temp\ MKDIR temp\
	cd temp
	IF NOT EXIST buffer\ MKDIR buffer\
	cd..
	CALL :DRAWHEADBA2MP4
	7ZA -y x %1 -o"%~dp0temp" >NUL 2>&1
	IF NOT EXIST temp\desc.txt 7za -y x temp\system\media\*.zip -o"%~dp0temp" >NUL 2>&1
	IF NOT EXIST temp\desc.txt (
		CALL :DRAWHEADBA2MP4
		ECHO[
		ECHO _________________________________________________________		
		ECHO[
		ECHO There isn't a desc.txt file in that zip...
		ECHO[
		ECHO Error was with the following zip file.
		ECHO[
		ECHO %1
		ECHO[
		ECHO Press any key to continue to the main menu.
		ECHO[
		PAUSE >NUL
		RMDIR temp /s /q
		GOTO :MAINMENUBA2MP4)
	IF NOT EXIST zips\ MKDIR zips\
	MOVE %~1 zips\%~1 >NUL 2>&1
GOTO :EOF

:NAMECONCATALL
	SET savename=%TIME::=_%
	SET savename=%savename:.=%
	SET savename=%savename: =%
	SET savename=%~1%savename%CC
GOTO :EOF

:COUNTFILES
	FOR /F %%A IN ('dir videos\*.%videotype% /a-d-s-h /b ^| FIND /v /c ""') DO SET /A filesinbav=%%A >NUL 2>&1
	FOR /F %%A IN ('dir zips\*.zip /a-d-s-h /b ^| FIND /v /c ""') DO SET /A filesinbaz=%%A >NUL 2>&1

GOTO :EOF
:FFVIEW
	ECHO[
	ECHO[
	ECHO _________________________________________________________	
	ECHO[
	ECHO[
	ECHO[
	ECHO There was an error within FFmpeg.  Run ba2mp4.bat -d
	ECHO[
	ECHO ^(with the parameter -d at the end^).  The easiest way to
	ECHO[
	ECHO do this is right click in windows on ba2mp4 file and
	ECHO[
	ECHO in the menu select create shortcut.  Right click on 
	ECHO[
	ECHO the new shortcut, it will be "ba2mp4.bat - Shortcut"
	ECHO[
	ECHO select "Properties" and at the end of the target 
	ECHO[
	ECHO (outside of the quote marks) put a -d
	ECHO[
	ECHO Now double click on the shortcut you made and see what
	ECHO[
	ECHO error messages come up while you try and repeat the 
	ECHO[
	ECHO error in FFmpeg.  If you PM me I will try and help you.
	PAUSE >NUL
	
	
:FINISH
	ADB kill-server -d >NUL 2>&1
	IF EXIST temp\ RMDIR temp /s /q
	ENDLOCAL
EXIT
Last edited by makers_mark; 22nd February 2014 at 07:49 AM. Reason: updated script
The Following 5 Users Say Thank You to makers_mark For This Useful Post: [ View ]
26th February 2014, 12:32 AM   |  #3  
Recognized Contributor
Thanks Meter: 10,103
 
5,199 posts
Join Date:Joined: Mar 2013
More
Thanks! IŽll give it a try after work
26th February 2014, 12:55 AM   |  #4  
makers_mark's Avatar
OP Member
Flag Kings Mountain
Thanks Meter: 147
 
98 posts
Join Date:Joined: Sep 2013
More
Quote:
Originally Posted by Android-Andi

Thanks! IŽll give it a try after work

Any feedback is gratefully appreciated!
The Following User Says Thank You to makers_mark For This Useful Post: [ View ]
26th February 2014, 01:41 AM   |  #5  
Senior Member
Thanks Meter: 2,593
 
1,191 posts
Join Date:Joined: Sep 2012
More
Question
Ain't got no windows... i've tried this before, in linux, and ffmpeg, and was able to get the video done for a particular folder, not for all the folders, and then, just merge the videos...

don't understand much of windows batch scripting (due to long term linux exposure)... if you'd say what you'd done to 'merge' the folders, and make a video?
Last edited by thewisenerd; 26th February 2014 at 01:45 AM.
26th February 2014, 01:54 AM   |  #6  
Junior Member
Thanks Meter: 3
 
24 posts
Join Date:Joined: Apr 2012
It's great work, thanks for your share. i'll try.
The Following User Says Thank You to yihongyuelan For This Useful Post: [ View ]
26th February 2014, 02:02 AM   |  #7  
makers_mark's Avatar
OP Member
Flag Kings Mountain
Thanks Meter: 147
 
98 posts
Join Date:Joined: Sep 2013
More
Quote:
Originally Posted by thewisenerd

Ain't got no windows... i've tried this before, in linux, and ffmpeg, and was able to get the video done for a particular folder, not for all the folders, and then, just merge the videos...

don't understand much of windows batch scripting... if you'd say what you'd done to 'merge' the folders, and make a video?

Absolutely!

After a folder is made into a video I use the following line in the script:

Code:
FOR /L %%J in (1,1,!folderrepeats[%%A]!) DO ECHO file temp\\buffer\\%%A%savename%.%videotype%>>copylist.txt
This is a loop that is going to loop the number of times a folder is going to repeat (the first number after p). Each iteration of the loop it will write in regular text "file temp.....(the directory of the video file that was just saved).. to the file "copylist.txt" . Notice the >> double. In batch that appends to the file already (if one exists, if the file doesn't exist then that'll be your first line).

Copylist.txt is a text file that in the end will have a list of the small mp4 file locations in the specific format required by ffmpeg. Here is an example of a copylist.txt.

Code:
file temp\\buffer\\130_30_480X854_crf23_orangeDroidDoes20_48_3137.mp4
file temp\\buffer\\230_30_480X854_crf23_orangeDroidDoes20_48_3137.mp4
file temp\\buffer\\330_30_480X854_crf23_orangeDroidDoes20_48_3137.mp4
file temp\\buffer\\330_30_480X854_crf23_orangeDroidDoes20_48_3137.mp4
file temp\\buffer\\330_30_480X854_crf23_orangeDroidDoes20_48_3137.mp4
file temp\\buffer\\330_30_480X854_crf23_orangeDroidDoes20_48_3137.mp4
Those are the 6 videos that will be put together in the end with the ffmpeg concat filter. There are actually 3 different videos with the last one repeated 4 times. I chose 4 to loop the last one to simulate waiting for boot. See the naming prefix on the files 1,2,3,3,3,3.

In windows you have to use the double backslashes because the first backslash escapes the second one, so that when it goes back into ffmpeg (as a command) it is actually seen as one backslash. You would just put your directory normally if you are using Linux.
Thats all pretty simple and works out great for a loop. In the end I put all of the animations together with the "concat" filter in ffmpeg. Here is the line:

Code:
	FFMPEG %ffdebug% %ffshowb% -f concat -i copylist.txt -vcodec copy -y %savefolder%\%savename%.%videotype% %outputtogif% || GOTO :FFVIEW
You may have to check with your version of ffmpeg, as some of the Linux versions are a bit older: So I can't say for sure whether or not you'll have access for it. I hope you do, it is seamless and backs the frames up perfectly.

EDIT: Just so you know. The text file I am writing to can be called anything, it doesn't have to be "copylist.txt" As long as it's referenced in the above line for ffmpeg to concat "yourlistyounamewhateveryouwant.txt" You don't even have to add the txt extension.
Last edited by makers_mark; 26th February 2014 at 02:06 AM. Reason: add explanation
The Following 2 Users Say Thank You to makers_mark For This Useful Post: [ View ]
26th February 2014, 03:45 AM   |  #8  
Recognized Contributor
Flag Texas
Thanks Meter: 940
 
2,982 posts
Join Date:Joined: Mar 2009
More
Just came by to say great work. Saw this on the XDA portal so I hope more devs will give video previews of their bootanimations
The Following User Says Thank You to Stryder5 For This Useful Post: [ View ]
26th February 2014, 08:28 AM   |  #9  
iamelton's Avatar
Senior Member
Flag Hong Kong
Thanks Meter: 329
 
906 posts
Join Date:Joined: Feb 2011
thx for the useful util..

i tried to run the batch file and got "Choice is not an internal or external command" error, and it exited..
for the record im using WinXP Professional..
The Following User Says Thank You to iamelton For This Useful Post: [ View ]
26th February 2014, 11:54 AM   |  #10  
makers_mark's Avatar
OP Member
Flag Kings Mountain
Thanks Meter: 147
 
98 posts
Join Date:Joined: Sep 2013
More
Quote:
Originally Posted by iamelton

thx for the useful util..

i tried to run the batch file and got "Choice is not an internal or external command" error, and it exited..
for the record im using WinXP Professional..

I am sorry, some versions of XP and 2000 don't support "choice" which is a simple command in Windows to get user input. Just out of curiosity, do you have service pack 2?
One way to get it working is install the windows resource kit. Thank you for pointing that out I will update op today.
Last edited by makers_mark; 28th February 2014 at 12:35 AM. Reason: Fixed link

The Following User Says Thank You to makers_mark For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
bootanimation youtube boot animation mp4
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Themes by ThreadRank