PDA

View Full Version : MP4Box created files won't play in Quicktime/Itunes (error -2014 incorrect duration)


jonathonsunshine
4th October 2008, 16:41
howdy yall

I want to make a batch file to create iPod compatible mp4 video files from AVI s.

If I make a Avisynth script, a really basic one, like


directshowsource("myvideofile.avi")

and then use it as the video and the audio source in MeGui it works fine. I try to take the commands from MeGui's log and put them in a batch file, it SEEMS to work fine, the file plays ok under MPC or VLC but quicktime says "Error -2014: the movie contains an incorrect duration (myvideofile.mp4)"

here are the commands i use (i have separated them out from batch file but I have posted the complete contents of the batchfile and the avisynth script at the bottom)

for creating audio

"F:\AA - Video Audio Encoding Scripts\Programs\bepipe\bepipe.exe" --script "directshowsource(^myavifile.avi^) .convertaudiotofloat .normalize .convertaudioto16bit" | "F:\AA - Video Audio Encoding Scripts\Programs\NeroAAC\neroAacEnc_SSE2.exe" -q 0.4 -ignorelength -if - -of "F:\AA - Video Audio Encoding Scripts\ipod\ipodaudio.mp4"



for creating video

"C:\Program Files\megui\tools\x264\x264.exe" --crf 20 --level 3 --no-cabac --partitions p8x8,b8x8,i4x4 --qpmin 16 --vbv-bufsize 1500 --vbv-maxrate 1500 --me umh --merange 12 --threads auto --thread-input --sar 1:1 --progress --no-psnr --no-ssim --output "F:\AA - Video Audio Encoding Scripts\ipod\ipodvideo.mp4" "F:\AA - Video Audio Encoding Scripts\ipod\ipodvideo.avs"


and then muxing them together

"C:\Program Files\megui\tools\mp4box\mp4box.exe" -add "f:\AA - Video Audio Encoding Scripts\ipod\ipodvideo.mp4" -add "f:\AA - Video Audio Encoding Scripts\ipod\ipodaudio.mp4" -tmp "f:\AA - Video Audio Encoding Scripts\ipod" -new "f:\AA - Video Audio Encoding Scripts\ipod\ipodvideo-muxed.mp4"

the file appears to be fine in MPC or VLC but quictime gives that error code and iTunes acts like it doesn't exist. (IE I drag and drop it on my ipod and there is no response.

Any ideas appreciated.





My complete batch file
---------------------------------------------------------
---------------------------------------------------------

:loop

echo LoadPlugin("F:\AA - Video Audio Encoding Scripts\Programs\DGIndex\autocrop.dll") > "F:\AA - Video Audio Encoding Scripts\ipod\header.avs"
echo out_width = 320 >> "F:\AA - Video Audio Encoding Scripts\ipod\header.avs"
echo movie = directshowsource(%1) >> "F:\AA - Video Audio Encoding Scripts\ipod\header.avs"

copy "F:\AA - Video Audio Encoding Scripts\ipod\header.avs"+"F:\AA - Video Audio Encoding Scripts\ipod\base.avs" "F:\AA - Video Audio Encoding Scripts\ipod\ipodvideo.avs" /b

"F:\AA - Video Audio Encoding Scripts\Programs\bepipe\bepipe.exe" --script "directshowsource(^%~dpnx1^).convertaudiotofloat.normalize.convertaudioto16bit" | "F:\AA - Video Audio Encoding Scripts\Programs\NeroAAC\neroAacEnc_SSE2.exe" -q 0.4 -ignorelength -if - -of "F:\AA - Video Audio Encoding Scripts\ipod\ipodaudio.mp4"

"C:\Program Files\megui\tools\x264\x264.exe" --crf 20 --level 3 --no-cabac --partitions p8x8,b8x8,i4x4 --qpmin 16 --vbv-bufsize 1500 --vbv-maxrate 1500 --me umh --merange 12 --threads auto --thread-input --sar 1:1 --progress --no-psnr --no-ssim --output "F:\AA - Video Audio Encoding Scripts\ipod\ipodvideo.mp4" "F:\AA - Video Audio Encoding Scripts\ipod\ipodvideo.avs"



"C:\Program Files\megui\tools\mp4box\mp4box.exe" -add "f:\AA - Video Audio Encoding Scripts\ipod\ipodvideo.mp4" -add "f:\AA - Video Audio Encoding Scripts\ipod\ipodaudio.mp4" -tmp "f:\AA - Video Audio Encoding Scripts\ipod" -new "f:\AA - Video Audio Encoding Scripts\ipod\ipodvideo-muxed.mp4"



ren "F:\AA - Video Audio Encoding Scripts\ipod\ipodvideo-muxed.mp4" "%~n1.mp4"

pause
shift
IF NOT %1 == "" GOTO LOOP

---------------------------------------------------------
---------------------------------------------------------



an example of the avisynth script that my batch file creates

---------------------------------------------------------
---------------------------------------------------------
LoadPlugin("F:\AA - Video Audio Encoding Scripts\Programs\DGIndex\autocrop.dll")
out_width = 320
movie = directshowsource("F:\+ P2P\uTorrent\Finished\TV\Stella\05 - Paper Route.avi")

cropclip = autocrop(movie,mode=0,wmultof=4,hmultof=4,samples=10,aspect=0,threshold=34,samplestartframe=0,leftadd=0,rightadd=0,topadd=0,bottomadd=0)
fixed_aspect = 1
c_width = width(cropclip)
c_height = round(height(cropclip) / fixed_aspect)
input_par = float(c_width)/float(c_height)
out_height = round(float(out_width) / input_par)
hmod = out_height - (floor(out_height / 16 ) * 16)
out_height = (hmod > 4) ? (out_height + (16 - hmod)) : (out_height - hmod)
new_aspect = (float(out_width) / float(out_height)) / fixed_aspect
autocrop(movie,mode=0,wmultof=4,hmultof=4,samples=10,aspect=new_aspect,threshold=34,samplestartframe=0,leftadd=0,rightadd=0,topadd=0,bottomadd=0)
LanczosResize(out_width,out_height)


---------------------------------------------------------
---------------------------------------------------------

crypto
4th October 2008, 18:32
Hi, that's a known problem with mp4box. See this thread (http://forum.doom9.org/showthread.php?p=1126702#post1126702) and this (http://forum.doom9.org/showthread.php?p=1146232#post1146232) for a solution.

SeeMoreDigital
4th October 2008, 18:33
Generating QuickTime compliant muxes with MP4Box can be a "hit-and-miss" affair.... I suggest you try using Crypto's MP4Muxer instead.

EDIT: Looks like Crypto beat me to it....

jonathonsunshine
5th October 2008, 15:46
It seems that MP4Creator can only handle elementary streams. Which in itself isn't an issue but it seems it needs to be told the framerate of h264 streams ? Is there away to use it with muxed streams already ?

Or alternativly, can someone tell me what MeGui is doing that I'm not ?