VideoHelp Forum




+ Reply to Thread
Results 1 to 1 of 1
  1. Member
    Join Date
    Oct 2010
    Location
    Brazil
    Search PM
    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
    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%
    Drag and drop the .avi file to it and will work it out.
    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.
    Last edited by leandro; 19th Jul 2012 at 19:03. Reason: fixing
    Quote Quote  



Similar Threads

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