hydra3333
12th September 2010, 08:25
I have a number of .asf files captured from various old and crummy still cameras - family, kids growing up etc. I need to convert these into .mp4's which will play on my WDTVlive box. I thought a combination of ffmpeg and x264, no worries.
Oops. The resulting mp4 framerate is a lot faster than the audio in the resulting .mp4 - the video plays fast and then stops whilst the rest of the audio keeps playing. Also, ffmpeg spits with a number of invalid asf headers.
No worries, I thought, I'll just pop them though avisynth directshowsource with fps=xx,convertfps=true and use that as input to x264.
Oops, I can't find a way to determine the right framerate to use with fps=xx. Mediainfo doesn't help, it gives no info on framerate.
Any suggestions ? Hope this is the right forum, it's sort of an avisynth related question. Mod, feel free to move the post.
for reference, here's the .bat I was trying to use
@echo on
call :makeMP4 "T:\CONVERT\homepics\learningtoride.wmv"
pause
exit
:makeMP4
@ECHO ON
SET inpFile=%~1
set outfile=%~1.mp4
set tempmp2=%~1.temp.mp2
set tempmp4=%~1.temp.mp4
set tempavi=%~1.temp.avi
set audiohertz=44100
set audiobitrate=128k
set xvideobitrate=700
REM http://webcache.googleusercontent.com/search?q=cache:GjDb5a9HDWoJ:umibe.googlecode.com/svn-history/r8/trunk/umibe/resources/MediaInfo/Contrib/CLI_Help.doc+%2BMEDIAINFO+batch+file+tokens&cd=1&hl=en&ct=clnk&gl=au&client=firefox-a
"c:\software\mediainfo\mediainfo.exe" --full "%inpFile%"
"c:\software\mediainfo\mediainfo.exe" --Inform=Video;%%FrameRate%% "%inpFile%" > .\V.TXT
for /f "tokens=*" %%A in ('type ".\V.TXT"') do set FrameRate=%%A
"c:\software\mediainfo\mediainfo.exe" --Inform=Video;%%DisplayAspectRatio%% "%inpFile%" > .\V.TXT
for /f "tokens=*" %%A in ('type ".\V.TXT"') do set DisplayAspectRatio=%%A
"c:\software\mediainfo\mediainfo.exe" --Inform=Video;%%DisplayAspectRatio/String%% "%inpFile%" > .\V.TXT
for /f "tokens=*" %%A in ('type ".\V.TXT"') do set DisplayAspectRatio_STRING=%%A
del .\v.txt
REM start ---- %~1 ----
"C:\software\ffmpeg\0-LATEST-BETA\bin\ffmpeg.exe" -i "%inpfile%" -y -vcodec huffyuv -r %FrameRate% -an "%tempavi%"
"C:\software\X264\x264.exe" --thread-input --threads 3 --profile high --level 4.1 --preset fast --no-cabac --fps %FrameRate% --bitrate %xvideobitrate% --sar 1:1 -o "%tempmp4%" "%tempavi%"
"C:\software\ffmpeg\0-LATEST-BETA\bin\ffmpeg.exe" -i "%inpfile%" -y -r %FrameRate% -acodec mp2 -vol 768 -ac 2 -ar %audiohertz% -ab %audiobitrate% -vol 1024 "%tempmp2%"
"C:\SOFTWARE\MP4box\MP4Box.exe" -fps %FrameRate% -add "%tempmp4%":fps=%FrameRate% -add "%tempmp2%":lang=eng -new "%outfile%"
del %tempmp2%
del %tempmp4%
del %tempavi%
pause
REM end ---- %~1 ----
@ECHO OFF
goto :eof
Oops. The resulting mp4 framerate is a lot faster than the audio in the resulting .mp4 - the video plays fast and then stops whilst the rest of the audio keeps playing. Also, ffmpeg spits with a number of invalid asf headers.
No worries, I thought, I'll just pop them though avisynth directshowsource with fps=xx,convertfps=true and use that as input to x264.
Oops, I can't find a way to determine the right framerate to use with fps=xx. Mediainfo doesn't help, it gives no info on framerate.
Any suggestions ? Hope this is the right forum, it's sort of an avisynth related question. Mod, feel free to move the post.
for reference, here's the .bat I was trying to use
@echo on
call :makeMP4 "T:\CONVERT\homepics\learningtoride.wmv"
pause
exit
:makeMP4
@ECHO ON
SET inpFile=%~1
set outfile=%~1.mp4
set tempmp2=%~1.temp.mp2
set tempmp4=%~1.temp.mp4
set tempavi=%~1.temp.avi
set audiohertz=44100
set audiobitrate=128k
set xvideobitrate=700
REM http://webcache.googleusercontent.com/search?q=cache:GjDb5a9HDWoJ:umibe.googlecode.com/svn-history/r8/trunk/umibe/resources/MediaInfo/Contrib/CLI_Help.doc+%2BMEDIAINFO+batch+file+tokens&cd=1&hl=en&ct=clnk&gl=au&client=firefox-a
"c:\software\mediainfo\mediainfo.exe" --full "%inpFile%"
"c:\software\mediainfo\mediainfo.exe" --Inform=Video;%%FrameRate%% "%inpFile%" > .\V.TXT
for /f "tokens=*" %%A in ('type ".\V.TXT"') do set FrameRate=%%A
"c:\software\mediainfo\mediainfo.exe" --Inform=Video;%%DisplayAspectRatio%% "%inpFile%" > .\V.TXT
for /f "tokens=*" %%A in ('type ".\V.TXT"') do set DisplayAspectRatio=%%A
"c:\software\mediainfo\mediainfo.exe" --Inform=Video;%%DisplayAspectRatio/String%% "%inpFile%" > .\V.TXT
for /f "tokens=*" %%A in ('type ".\V.TXT"') do set DisplayAspectRatio_STRING=%%A
del .\v.txt
REM start ---- %~1 ----
"C:\software\ffmpeg\0-LATEST-BETA\bin\ffmpeg.exe" -i "%inpfile%" -y -vcodec huffyuv -r %FrameRate% -an "%tempavi%"
"C:\software\X264\x264.exe" --thread-input --threads 3 --profile high --level 4.1 --preset fast --no-cabac --fps %FrameRate% --bitrate %xvideobitrate% --sar 1:1 -o "%tempmp4%" "%tempavi%"
"C:\software\ffmpeg\0-LATEST-BETA\bin\ffmpeg.exe" -i "%inpfile%" -y -r %FrameRate% -acodec mp2 -vol 768 -ac 2 -ar %audiohertz% -ab %audiobitrate% -vol 1024 "%tempmp2%"
"C:\SOFTWARE\MP4box\MP4Box.exe" -fps %FrameRate% -add "%tempmp4%":fps=%FrameRate% -add "%tempmp2%":lang=eng -new "%outfile%"
del %tempmp2%
del %tempmp4%
del %tempavi%
pause
REM end ---- %~1 ----
@ECHO OFF
goto :eof