Log in

View Full Version : Examples of creating mp4/m4v files from AVIsynth


Starduster
6th August 2010, 12:01
Are there any examples of creating mp4 or m4v files from AVIsynth output? I'd like to combine a number of files of different types into one mp4 file. Any direction would be very much appreciated.

Thanks,

sr

J_Darnley
6th August 2010, 15:39
x264 input.avs -o output.mp4

Starduster
6th August 2010, 23:05
Well, that was pretty amazing! Only thing was, the sound didn't come over to the mp4. Is there another parameter I need to add?

sr

hydra3333
7th August 2010, 08:35
Assuming mpeg4 AVC rather than ASP ... well IIRC x264 doesn't do audio. So, you'd also need to convert audio. For PAL SD interlaced material to run on a WDTV Live, maybe something like this ?

"C:\software\X264\x264.exe" --thread-input --threads 3 --profile high --level 4.1 --preset fast --interlaced --tff --no-cabac --bitrate 2000 --sar 16:11 -o "temp.mp4" "AVS1.avs"
"C:\software\ffmpeg\0-LATEST-BETA\bin\ffmpeg.exe" -i "AVS1.avs" -y -ar 44100 -ac 2 -ab 256k -acodec mp2 -vol 1024 "temp.MP2"

"C:\SOFTWARE\MP4box\MP4Box.exe" -add "temp.mp4" -add "temp.MP2":lang=eng -new "the_result.mp4"

REM SAR = DAR / PAR
REM for 16:9 720x576i use --sar=16:11 (most 4:3 are in 16:9 shell frame nowadays, so use this)
REM for 16:9 1440x1080i use --sar=4:3
REM for 16:9 1920x1080i use --sar=1:1
REM
REM http://developer.divx.com/docs/divx_plus_hd/Creation_with_x264/
REM Interlaced resolution Support SARs
REM 1920x1080i50 1:1 (16:9 frame)
REM 1440x1080i50 1:1 (4:3 frame), 4:3 (16:9 frame)
REM 720x576i50 1:1, 16:11 (16:9 frame), 12:11 (4:3 frame)
REM 704x576i50 1:1, 16:11 (16:9 frame), 12:11 (4:3 frame)
REM 480x576i50 1:1, 24:11 (16:9 frame), 18:11 (4:3 frame)
REM 352x576i50 1:1, 32:11 (16:9 frame), 24:11 (4:3 frame)
REM
REM 1920x1080i60 1:1 (16:9 frame)
REM 1440x1080i60 1:1 (4:3 frame), 4:3 (16:9 frame)
REM 720x480i60 1:1, 40:33 (16:9 frame), 10:11 (4:3 frame)
REM 704x480i60 1:1, 40:33 (16:9 frame), 10:11 (4:3 frame)
REM 640x480i60 1:1 (4:3 frame)
REM 480x480i60 1:1, 20:11 (16:9 frame), 15:11 (4:3 frame)
REM 352x480i60 1:1, 80:33 (16:9 frame), 20:11 (4:3 frame)

It's going to be SLOW since the AVS is being processed twice (incl video). If you could do something smarter there, it'd be faster (eg a separate .avs for the audio which rids itself of the video).

J_Darnley
7th August 2010, 11:23
Well, that was pretty amazing! Only thing was, the sound didn't come over to the mp4. Is there another parameter I need to add?

sr

x264 doesn't do sound. Use an audio encoder or just hop straight on over to ffmpeg and do it all in one go.

2Bdecided
7th August 2010, 13:21
MeGUI is a good, simple way of doing both + muxing, with a few mouse clicks.

Cheers,
David.

Starduster
7th August 2010, 21:41
Thanks for the input guys... This needs to be done on the backside of a web page so I'm creating the .avs on the server so it sounds like ffmpeg is the best bet. I'll give that a try and may be back soon! ;-)