Windows Batch Encode Entire folder to Flash h264 MP4

Web programming topics
Post Reply
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Windows Batch Encode Entire folder to Flash h264 MP4

Post by Mysoogal » Mon Apr 26, 2010 4:31 am

UPDATED :D

TWO PASS ENCODING TO H264 MP4 USING FFMPEG

now batch deletes the first encode without qt faststart :mrgreen: can't believe how simple it was lol to add the delete function

Code: Select all

@ ECHO OFF
REM The following will convert all avi files in the current folder into mp4 files.

IF EXIST *.avi FOR %%A IN (*.avi) DO CALL :twopass "%%A"

:twopass
D:\server\encoder\ffmpeg.exe -y -i %* -b 2M -bt 4M -vcodec libx264 -pass 1 -fpre "D:\server\encoder\ffpresets\libx264-veryfast_firstpass.ffpreset" -s 640x360 -b 1000kbps -bt 800kbps -threads 4  output.mp4
D:\server\encoder\ffmpeg.exe -y -i %* -b 2M -bt 4M -vcodec libx264 -pass 2 -fpre "D:\server\encoder\ffpresets\libx264-veryfast.ffpreset" -s 640x360 -b 1000kbps -bt 800kbps -threads 4  output.mp4


RENAME output.mp4 %*.mp4

:QT Faststart 
D:\server\encoder\qt-faststart.exe  %*.mp4 %*.qt.mp4


:GET Thumbs
D:\server\encoder\ffmpeg.exe -v 0 -y -i %* -vframes 1 -ss 5 -vcodec mjpeg -f rawvideo -s 286x160 -aspect 16:9 %*.qt_mp4.jpg

ECHO Y | DEL %*.mp4

ECHO.
GOTO :EOF



of course you will need ffmpeg and qt - faststart

ffmpeg Link ---- http://ffmpeg.arrozcru.org/builds/
qt faststart --- http://notboring.org/devblog/2009/07/qt ... r-windows/


remember to change the path to your ffmpeg and qt faststart exe

Code: Select all

C:\location of \qt-faststart.exe 
almost forgot the ffmpeg preset files

Code: Select all

"D:\server\encoder\ffpresets\libx264-veryfast.ffpreset"
, also are in the ffmpeg zip inside a folder called shared, remember to also put the right path to them :mrgreen:

that's it


example info of a encoded file

Code: Select all

General
Complete name                    : D:\server\xampp\htdocs\files\UFO Files - Alien Encounters.divx.qt.mp4
Format                           : MPEG-4
Format profile                   : Base Media
Codec ID                         : isom
File size                        : 89.4 MiB
Duration                         : 45mn 5s
Overall bit rate                 : 277 Kbps
Encoded date                     : UTC 1970-01-01 00:00:00
Tagged date                      : UTC 1970-01-01 00:00:00
Writing application              : Lavf52.61.0

Video
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : [email protected]
Format settings, CABAC           : Yes
Format settings, ReFrames        : 4 frames
Codec ID                         : avc1
Duration                         : 45mn 5s
Bit rate mode                    : Variable
Bit rate                         : 200 Kbps
Width                            : 640 pixels
Height                           : 360 pixels
Display aspect ratio             : 16/9
Frame rate mode                  : Variable
Frame rate                       : 29.970 fps
Resolution                       : 24 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.029
Stream size                      : 64.5 MiB (72%)
Writing library                  : x264 core 85 r1442 781d300
Encoding settings                : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=2 / psy=1 / psy_rd=0.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=4 / sliced_threads=0 / nr=0 / decimate=1 / mbaff=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / wpredb=1 / wpredp=0 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc=2pass / mbtree=0 / bitrate=200 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.41 / pb_ratio=1.25 / aq=1:1.00
Encoded date                     : UTC 1970-01-01 00:00:00
Tagged date                      : UTC 1970-01-01 00:00:00

Audio
Format                           : AAC
Format/Info                      : Advanced Audio Codec
Format version                   : Version 4
Format profile                   : LC
Format settings, SBR             : No
Codec ID                         : 40
Duration                         : 45mn 5s
Bit rate mode                    : Variable
Bit rate                         : 72.0 Kbps
Channel(s)                       : 2 channels
Channel positions                : L R
Sampling rate                    : 44.1 KHz
Resolution                       : 16 bits
Stream size                      : 22.8 MiB (26%)
Encoded date                     : UTC 1970-01-01 00:00:00
Tagged date                      : UTC 1970-01-01 00:00:00

here is my zip package everything is in there to encode videos ffmpeg,qt fast start,mencoder,mplayer, codecs etc

everything inside the zip is updated

File Size: 47.54 MB
http://www.mediafire.com/?yg1zznamdmm
Last edited by Mysoogal on Wed Apr 28, 2010 12:51 am, edited 3 times in total.
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

Re: Windows Batch Encode Entire folder to Flash h264 MP4

Post by Saman » Mon Apr 26, 2010 11:04 am

Thanks. This is extremely useful for someone who's going to do batch encoding.
Keep up the good work.
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: Windows Batch Encode Entire folder to Flash h264 MP4

Post by Mysoogal » Tue Apr 27, 2010 1:07 am

this batch encoder has been updated, copy new one and replace old :) I've added the DEL function to remove the encoded file without qt fast start so now everything should be working as normal
Post Reply

Return to “Web programming”