Hey everyone, I'd like to share this script I wrote thanks to this forum and some research.
What does it do:
- normalize audio volume (aac/mp3)
- fix divx packed frames
- attach subtitle
- attach cover art
- add tag episode name
Basically, it extracts the audio and video from the source file and fix them producing a smaller filesize without reencoding anything.
The result is a MP4 containing: audio + video + subtitle + cover art + tag name for TV episode.
Make your suggestions and comments bellow.
Thanks
fixer.bat
Drag and drop the .avi file to it and will work it out.Code:set workdir=%temp% set tools=[your tools directory] %tools%\mediainfo\MediaInfo.exe --inform="Audio;%%Format%%" %1>%workdir%\codec.tmp Set /P codec=<%workdir%\codec.tmp del %workdir%\codec.tmp if "%codec%"=="AAC" ( %tools%\ffmpeg\ffmpeg -y -i %1 -vn -acodec copy %workdir%\_audio.mp4 set audio=%workdir%\_audio.mp4 ) if "%codec%"=="MPEG Audio" ( %tools%\ffmpeg\ffmpeg -y -i %1 -vn -acodec copy %workdir%\_audio.mp3 %tools%\mp3val\mp3val %workdir%\_audio.mp3 -f -nb %tools%\vbrfix\VbrfixConsole --removeUnknown --keepLameUpdateCrc %workdir%\_audio.mp3 %workdir%\fixed_audio.mp3 if exist %workdir%\fixed_audio.mp3 move /Y %workdir%\fixed_audio.mp3 %workdir%\_audio.mp3 set audio=%workdir%\_audio.mp3 ) %tools%\ffmpeg\ffmpeg -y -i %1 -an -vcodec copy %workdir%\_video.avi %tools%\mp4modifier\mmcl --unpack %workdir%\_video.avi %workdir%\unpacked.avi if exist %workdir%\unpacked.avi ( del %workdir%\_video.avi move %workdir%\unpacked.avi %workdir%\_video.avi ) if exist cover.jpg set cover=:cover="cover.jpg" if exist "%~n1.srt" set subtitle=-add "%~n1.srt:lang=eng:name=" rem if exist "%~n1.srt" set subtitle=-add "%~n1.srt:lang=eng:name=:font=Arial Black:size=24" set fname=%~n1 set t_string=%fname:~9,99% %tools%\mp4box\MP4Box -add "%workdir%\_video.avi#video:name=" -add "%audio%#audio:lang=eng:name=" %subtitle% -itags name="%t_string%"%cover% -new "%workdir%\final.mp4" "%audio%#audio:lang=eng:name=" %subtitle% -itags name="%t_string%"%cover% -new "%workdir%\final.mp4" if exist "%~n1.mp4" move "%~n1.mp4" "%~n1.mp4old" move %workdir%\final.mp4 "%~n1.mp4" del %workdir%\_video.avi %audio%
If you want the embedded cover, make sure you have cover.jpg in the same folder of the script.
If you want the subtitle attached, make sure it also is in the same directory and has the same name (.srt) of the video file.
If you want the Episode name to be tagged correclty, have the avi file name something like: "S07E12 - [...].avi"
In a folder containing 24x 175Mb avi files it saves like 40Mb from the total.
+ Reply to Thread
Results 1 to 1 of 1
-
Last edited by leandro; 19th Jul 2012 at 19:03. Reason: fixing
Similar Threads
-
Linux script to scan for corrupt AVI's
By kl1k in forum Newbie / General discussionsReplies: 3Last Post: 9th Mar 2012, 04:14 -
To Script or Not To Script, that is the Question... (Custom Videos)
By TheMcD in forum EditingReplies: 2Last Post: 21st Oct 2010, 10:11 -
fix Mp4 (Mov) files - binary/hex code
By octopus in forum Newbie / General discussionsReplies: 2Last Post: 24th Apr 2010, 17:00 -
Joining avi files with virtualdubmod script
By rhijaen in forum Video ConversionReplies: 1Last Post: 26th Oct 2009, 06:58 -
PHP code used to generate code for Avysinth join mov and avi files
By lindylex in forum User guidesReplies: 0Last Post: 19th Sep 2008, 03:37