Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 4th March 2006, 20:53   #1  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
avi2mp4 - How to easily create AVC MP4 files from AVI

after the whole discussion about how avi and vfw sucks (which doesnt need to be repeated in this thread) i decided to set up a simply thingie for allowing people to easily transform their x264 or other avc in .avi files losslessly to nice and clean avc .mp4 files:

1) download avi2mp4 (150 kb)
2) extract the files to the folder where your .avi is stored
3) rename the .avi to input.avi which you want to convert
4) double click on the avi2mp4.bat file with the framerate you want to have in your mp4
5) enjoy your output.mp4

avi2mp4 writes nothing to your registry, it doesnt install anything or does any other strange things, so nothing can happen (ok your house might explode )
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 5th March 2006, 02:05   #2  |  Link
Sirber
retired developer
 
Sirber's Avatar
 
Join Date: Oct 2002
Location: Canada
Posts: 8,978
Why doesn't it use the AVI FPS?
__________________
Detritus Software
Sirber is offline   Reply With Quote
Old 5th March 2006, 08:43   #3  |  Link
Yong
Registered User
 
Join Date: Jun 2004
Posts: 577
Here is the improved version :

Code:
@echo off
if '%1'=='' goto eof
title avi2mp4
avi2raw -e=4 -v "%~dpn1.avi" "%temp%\%~n1.264"
set a=-rate 15 -timescale=15000
set b=-rate 23.976 -timescale=23976
set c=-rate 25 -timescale=25000
set d=-rate 29.97 -timescale=29970
set e=-rate 30.00 -timescale=30000
echo select the fps
echo a = 15 , b = 23.976 , c = 25 , d = 29.97 , e = 30
set /p m=
if %m%==a (set n=%a%) else (if %m%==b (set n=%b%) else (if %m%==c (set n=%c%) else (if %m%==d (set n=%d%) else (if %m%==e (set n=%e%)))))
mp4creator -c "%temp%\%~n1.264" %n% "%~dpn1.mp4"
del "%temp%\%~n1.264"
pause>nul:
Save it to a batch file,
then "drag" or your h.264 avi video files to the batch file icon,
1. it will demux the avi to raw file(264)
2. select the fps
3. done

Note:
1. it cant batch process avi files because i use file name mask . but it still can do that by using some special "frontend"

EDIT:
batch file broken ,removed something as bond wish

Last edited by Yong; 7th March 2006 at 20:24.
Yong is offline   Reply With Quote
Old 5th March 2006, 11:00   #4  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
Yong, remove the xvid support. it will not work that way with crappy avi files packed bitstream ones
i limited this to avc on purpose!

also remove the mp4info thing, i want this to be as simple and newbie friendly as possible (including needing as few tools of whatever kind as necessary)

for converting asp avi files using mp4box/yamb is far superior and should be used exclusively
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free

Last edited by bond; 5th March 2006 at 11:08.
bond is offline   Reply With Quote
Old 5th March 2006, 11:57   #5  |  Link
Yong
Registered User
 
Join Date: Jun 2004
Posts: 577
Ok bond, its done.
i add mp4info thing because the mp4cretor -verbose=1 is *too* verbose,
and it for my own use only(to ensure my batchfile is working...)
btw, is that -optimize thing safe to use?
And why choose mp4creator as the mp4 muxer?
Yong is offline   Reply With Quote
Old 5th March 2006, 12:30   #6  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
Quote:
Originally Posted by Yong
Ok bond, its done.
thx!
now the question is, is it really more newbie proove to make them input the fps via cmdl than the way i did it?

is it really more newbie proove to make people drag and drop their avi to the bat?

what do you guys think?

Quote:
i add mp4info thing because the mp4cretor -verbose=1 is *too* verbose,
and it for my own use only(to ensure my batchfile is working...)
yeah i found that too, but using an extra tool just for displaying some info isnt really worth it imho

Quote:
btw, is that -optimize thing safe to use?
it makes the headers to be stored in front of the video data instead of after the data, which is nice but not really needed
also i am not sure if this doesnt lead to some sort of "two pass" muxing needing twice the filesize space so i left it away

Quote:
And why choose mp4creator as the mp4 muxer?
because its smaller than mp4box (and we dont need all the other fancy stuff mp4box can do here anyways)
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 5th March 2006, 13:13   #7  |  Link
Yong
Registered User
 
Join Date: Jun 2004
Posts: 577
Quote:
Originally Posted by bond
thx!
now the question is, is it really more newbie proove to make them input the fps via cmdl than the way i did it?

is it really more newbie proove to make people drag and drop their avi to the bat?

what do you guys think?
i could be wrong, but imho "drag n drop" is much easier than rename the file to "input.avi",
and the output mp4 filename will exactly same as the input avil filename.
the fps option only need to type a, b, c and ect then press enter only.
but let us hear the user opinion 1st
Quote:
yeah i found that too, but using an extra tool just for displaying some info isnt really worth it imho
the mp4info is to let the newbies know whether they will get the right fps, because mp4creator is too silent,
its doesnt print anything when the muxing done
unless there is something wrong with the h264 es file like:
"error decoding SEI message"...
Yong is offline   Reply With Quote
Old 5th March 2006, 13:18   #8  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
i tested mp4creator extensively and it should produce perfect files always
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 5th March 2006, 17:28   #9  |  Link
Kostarum Rex Persia
Banned
 
Join Date: May 2005
Location: Serbia
Posts: 565
Bond, I converted my x264 AVI file with your little program, but when I start watching x264 MP4 video, sound doesn't exist at all.

Source AVI file is 175 MB, output MP4 file is 135 MB? Why without sound, Bond?
Kostarum Rex Persia is offline   Reply With Quote
Old 5th March 2006, 23:26   #10  |  Link
Inventive Software
Turkey Machine
 
Join Date: Jan 2005
Location: Lowestoft, UK (but visit lots of places with bribes [beer])
Posts: 1,953
I have a similar system, but I use MP4Box. Consists of 4 commands, and works every time. I'll post the batch file later on.

@Yong: Drag and drop can be implemented with .bat files, but I can't remember how. I'll get back to ya on that one.
__________________
On Discworld it is clearly recognized that million-to-one chances happen 9 times out of 10. If the hero did not overcome huge odds, what would be the point? Terry Pratchett - The Science Of Discworld
Inventive Software is offline   Reply With Quote
Old 5th March 2006, 23:30   #11  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
Quote:
Originally Posted by Kostarum Rex Persia
Bond, I converted my x264 AVI file with your little program, but when I start watching x264 MP4 video, sound doesn't exist at all.

Source AVI file is 175 MB, output MP4 file is 135 MB? Why without sound, Bond?
avi2mp4 only converts the video from avi to mp4

for the audio you should use aac, which is highly unlikely stored in avi anyways

also most people encode the audio outside virtualdub (eg in besweet) and mux it afterwards to the avi
so when doing a rip you simply save the step muxing the audio to avi with virtualdub but mux directly the audio stream to mp4 or mkv with the specific tools (yamb or mkvmerge for example)
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 6th March 2006, 01:52   #12  |  Link
Kostarum Rex Persia
Banned
 
Join Date: May 2005
Location: Serbia
Posts: 565
Ok, thank you, Bond. Problem is solved.
Kostarum Rex Persia is offline   Reply With Quote
Old 6th March 2006, 11:00   #13  |  Link
Yong
Registered User
 
Join Date: Jun 2004
Posts: 577
Quote:
Originally Posted by Inventive Software
@Yong: Drag and drop can be implemented with .bat files, but I can't remember how. I'll get back to ya on that one.
Yup my avi2mp4 batch file is drag n drop based.
the %1 or "%~1" is stand for input filename.

btw bond, is that usefull if add audio muxing to this avi2mp4 batch file?
its not require extra step or tools
Yong is offline   Reply With Quote
Old 6th March 2006, 11:12   #14  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
imho its not useful to add audio muxing, because mp4box is also a far better tool for mp3-in-avi to mp4 muxing (the rest isnt supported anyways)
also than people start to bug why their ac3 audio in avi isnt muxed aso...

i wanted to keep this as simple as possible, to make it as easy as possible for people who cant stop using virtualdub for x264 video encoding to still be easily able to remux the resulting video stream from avi to mp4
nothing less, nothing more
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 29th October 2006, 07:54   #15  |  Link
fight2win
What's in a name dude !
 
fight2win's Avatar
 
Join Date: Sep 2005
Location: Cloud 9
Posts: 334
thanks bond
fight2win is offline   Reply With Quote
Old 6th February 2007, 16:05   #16  |  Link
Sirber
retired developer
 
Sirber's Avatar
 
Join Date: Oct 2002
Location: Canada
Posts: 8,978
anything similar but whitout the need to specify the FPS?
__________________
Detritus Software
Sirber is offline   Reply With Quote
Old 6th February 2007, 18:36   #17  |  Link
Inventive Software
Turkey Machine
 
Join Date: Jan 2005
Location: Lowestoft, UK (but visit lots of places with bribes [beer])
Posts: 1,953
MP4Box defaults to 25 FPS anyway, so it'll need some kind of detection on the streams, something I don't believe MP4Box has at the moment.
__________________
On Discworld it is clearly recognized that million-to-one chances happen 9 times out of 10. If the hero did not overcome huge odds, what would be the point? Terry Pratchett - The Science Of Discworld
Inventive Software is offline   Reply With Quote
Old 6th February 2007, 19:38   #18  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
there has been a patch for mp4box reading out the fps if specified in the raw stream, but it seemed to didnt work correctly, so it is disabled atm

maybe someone can fix it:
http://sourceforge.net/tracker/index...01&atid=571738
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:03.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.