View Full Version : Mp4 -> Avi
Slifer
17th May 2008, 21:29
Ok, i am not new on the encoding scene or anything. However, this is a problem i cant seem to fix.
I can convert a .mp4 file to .avi using xvid as usual.
But there is a problem; i always get either super speedy sound, or super speedy video. It is really bad. Is there a way to convert without this problem. Thanx 4 the help guys.
BTW, this site is amazing, im glad i found it ;)
stax76
17th May 2008, 22:47
Welcome to the forum. :)
Why do you want to convert it?
LoRd_MuldeR
17th May 2008, 23:11
@Slifer
Question:
1. What video format is stored in your MP4 file? Analyze your file with Avinaptic, if you don't know.
2. Do you just want to re-mux the video to another container or do you want to re-encode to another video format?
If your MP4 file contains a H.264 stream and you want to re-mux that to AVI for whatever reason, you can do it like this:
Extract the H.264 stream from it's MP4 container with YAMB/MP4Box and then mux it into AVI with the "avc2avi" tool.
If you want to re-encode the video, which is a lossy process, you might want to give Avidemux or MeGUI a try...
Slifer
18th May 2008, 08:07
@stax:- I need to convert it because it is a bit too big.
@LoRd_MuldeR:-
Thanx for that, i will give it a try, especially since you guys know what to do with mp4s and i dont have much exp with them...
LoRd_MuldeR
18th May 2008, 13:44
We could give you more information, if you answer the questions from my previous post...
Question:
1. What video format is stored in your MP4 file? Analyze your file with Avinaptic, if you don't know.
2. Do you just want to re-mux the video to another container or do you want to re-encode to another video format?
Slifer
18th May 2008, 19:06
Here is all the info produced:
[ About file ]
Name: 05-Ace Dragons Clash! Stardust VS Red Demon's.mp4
Date: 7/05/2008 20:40:45
Size: 390,696,088 bytes (372.597 MB)
[ Generic infos ]
Play duration: 00:23:55 (1435.006666 s)
Container type: MP4/MOV
Major brand: ISO Base Media version 1
Creation time: 29/04/2008 18:32:30 UTC
Modification time: 30/04/2008 19:28:01 UTC
Number of streams: 2
Type of stream nr. 1: video (avc1) {GPAC ISO Video Handler}
Type of stream nr. 2: audio (AAC Low complexity) {GPAC ISO Audio Handler}
Audio streams: 1
[ Relevant data ]
Resolution: 704 x 480
Width: multiple of 32
Height: multiple of 32
[ Video track ]
Codec: avc1
Resolution: 704 x 480
Frame aspect ratio: 22:15 = 1.466666
Pixel aspect ratio: 1:1 = 1
Display aspect ratio: 22:15 = 1.466666
Framerate: 24.186786 fps
Number of frames: 34703
Bitrate: 1977.429772 kbps
[ Audio track ]
Codec: AAC Low complexity
Bitrate: 193.402149 kbps
Channels: 2
Sample rate: 48000 Hz
[ About H.264 encoding ]
User data: x264
User data: core 58
User data: H.264/MPEG-4 AVC codec
User data: Copyleft 2003-2008
User data: http://www.videolan.org/x264.html
User data: cabac=0
User data: ref=1
User data: deblock=1:1:1
User data: analyse=0x3:0x113
User data: me=umh
User data: subme=6
User data: me-prepass=0
User data: brdo=1
User data: mixed_ref=0
User data: me_range=32
User data: chroma_me=1
User data: trellis=0
User data: 8x8dct=1
User data: cqm=0
User data: deadzone=21,11
User data: chroma_qp_offset=0
User data: threads=4
User data: nr=0
User data: decimate=1
User data: mbaff=0
User data: bframes=3
User data: b_pyramid=0
User data: b_adapt=1
User data: b_bias=5
User data: direct=3
User data: wpredb=1
User data: bime=1
User data: keyint=240
User data: keyint_min=1
User data: scenecut=50(pre)
User data: rc=crf
User data: crf=21.0
User data: rceq='blurCplx^(1-qComp)'
User data: qcomp=0.70
User data: qpmin=10
User data: qpmax=51
User data: qpstep=8
User data: ip_ratio=1.60
User data: pb_ratio=1.30
User data: aq=1:-0.3:11.0
User data: aq2=1:0.3:15.0
SPS id: 0
Profile: High@L4.1
Num ref frames: 2
Aspect ratio: 40:33 (16:9 NTSC pixel shape)
Chroma format idc: YUV 4:2:0
PPS id: 0 (SPS: 0)
Entropy coding type: CAVLC
Weighted prediction: No
Weighted bipred idc: B slices - implicit weighted prediction
8x8dct: Yes
[ Profile compliancy ]
Profile to check: MTK PAL 6000
Resolution: Ok
Framerate: 24.186786 <> 25
And i just wanna be able to reencode it so i can add subs and make it smaller. I have many encoding progs, but only your Mencoder264 actually works properly with it...
roozhou
18th May 2008, 19:09
Framerate: 24.186786 fps...
Is that vfr?AFAIK only mencoder supports vfr output.
LoRd_MuldeR
18th May 2008, 19:23
And i just wanna be able to reencode it so i can add subs and make it smaller. I have many encoding progs, but only your Mencoder264 actually works properly with it...
So it's H.264 video in MP4 container. Avidemux (http://forum.doom9.org/showthread.php?p=1006659#post1006659) should be able to handle that, but not frame-accurately ...
Slifer
18th May 2008, 20:50
I use avidemux alot, and im afraid even that don't work...
It still goes either mega fast with sound, or mega fast with video.
Trust me to have a really weird .mp4 file lol ;)
Is vfr variable frame rate?
Coz that does sound like it could be the cause of this prob...
LoRd_MuldeR
18th May 2008, 21:27
Is vfr variable frame rate?
Coz that does sound like it could be the cause of this prob...
Yes, VFR is Variable Framerate and I'm not aware of any (OpenSource) Video Editor that handles VFR.
There are ways to convert VFR to CFR by duplicating/skipping frames though...
Ranguvar
19th May 2008, 13:35
Now, I don't have much experience with VFR, but isn't there an app that will make a timecodes file of the video (saying how long to play each frame)?
And then you can just encode as if it's CFR, and use the timecodes when you mux to MP4 or MKV...
LoRd_MuldeR
19th May 2008, 13:46
So far I only dealt with VFR in some nasty WMV videos.
And I used DirectShowSource(FPS=25,convertFPS=true) to convert it to CFR for further processing...
roozhou
19th May 2008, 15:12
1:
Use DTSRepair to extract timecodes from .mp4 file. Reencoding with avs(Do not add/del frames), this timecodes would help remuxing to avi/mkv/mp4 with correct speed. Use tc2cfr for .avi, mkvtoolnix/avi_mux_gui for .mkv, tc2mp4 for .mp4.
2:
Use mencoder and output to .avi and no timecodes are needed. Do not use b-frames.
Slifer
19th May 2008, 20:10
Why do they have to make it sooooo complicated...?
Fair enough the quality is really good, but...
Oh well, i will try your solution roozhou
LoRd_MuldeR
19th May 2008, 20:56
The question is: Why do they invent "features" like VFR, that almost no video editor supports natively...
roozhou
19th May 2008, 21:31
The question is: Why do they invent "features" like VFR, that almost no video editor supports natively...
1:Bitrate can be reduced dramatically with vfr at still scenes.
2:Some video are combination of progress + interlaced/telecined. The interlaced parts need to be bobbed and telecined parts need to be IVTCed.
Don't complain "why do they invent VFR" but please think about why such crappy video editors as VDM do not support VFR. Why not use timestamps instead of fps+frame NO. to mark each frame?
LoRd_MuldeR
20th May 2008, 02:32
1:Bitrate can be reduced dramatically with vfr at still scenes.
Skipping entire frames would require perfectly still screnes (no movement at all, and most important: no noise and no grain!)
Since such source doesn't exist in reality (except for 100% computer animated stuff), this won't be of any actual use.
P-Frames plus a large I-Frame interval should be sufficient to handle any "still" scene you meet in real life video...
2:Some video are combination of progress + interlaced/telecined. The interlaced parts need to be bobbed and telecined parts need to be IVTCed.
That's the only rare case in which I'd consider using VFR. But if you have such "mixed" material, a lot was already screwed up in production...
Don't complain "why do they invent VFR" but please think about why such crappy video editors as VDM do not support VFR. Why not use timestamps instead of fps+frame NO. to mark each frame?
Calling VirtualDub a "crappy video editor" is unjustified!
Why not use timestamps? Because it's much harder to implement and most video editing/processing tools don't support it.
If you want to process VFR, every single tool in your encoding chain needs to support it. Otherwise you'll have to convert it back to CFR or use ugly workarounds.
Since VFR is of rare practical use, it's very unlikely all those video editors will be rewritten to support it...
roozhou
20th May 2008, 03:45
Skipping entire frames would require perfectly still screnes (no movement at all, and most important: no noise and no grain!)
Since such source doesn't exist in reality (except for 100% computer animated stuff), this won't be of any actual use.
No. These are called "nearly-duplicate remove filters". You can set a threshold indicating how "nearly". My personal tests show that 25%+ frames can be removed for animes and 15%+ frames for real life movies.
RV10, VP6, VP7 encoders supports VFR output. This feature is also useful for streaming because less frames are encoded and the encoding process speeds up.
That's the only rare case in which I'd consider using VFR. But if you have such "mixed" material, a lot was already screwed up in production...
There are many hybrid material DVDs, especially animes.
Why not use timestamps? Because it's much harder to implement and most video editing/processing tools don't support it.
But all media players can play and seek VFR videos without any problem. Look at source codes of mplayer/mencoder and you will see "double PTS" as parameter passing through decoder -> filter chain -> encoder -> muxer.
Inventive Software
20th May 2008, 04:04
Please don't justify VFR. It's hideous, it should have been dumped long ago, but still it keeps coming back. There is a reason why DVDs and HD-DVD / BluRay discs don't allow it.
Slifer
20th May 2008, 09:29
Oh great i have started a war ;)
I found that buzzqw's encoder has the abilty to reencode without this problem. Only thing is i never let it finish...
Maybe vfr will we used alot more someday, and people will be able to encode without the problem i get. Anyway, i will encode the eppy i have and see if it fully works then get back to you.
GodofaGap
22nd May 2008, 09:35
The reason why Avisynth and VirtualDub don't really support VFR is because the output format (AVI) does not support it either. VFR is not something that is incredibly hard to overcome, but the effort is simply not justified if you cannot use it anyway.
I do not believe that dupe detecting filters are really that beneficial (unless to remove teleciding), as a frame that is a dupe of the previous one should be able to be encoded very efficiently. If I want near-dupes to be dropped is mostly a matter of taste, but I'd rather be on the side of caution. Dropping 15% of real life content seems a bit overdoing it.
Have any tests been done where the benefit of dupe filters has been determined (where motion fluidity remains intact)?
roozhou
22nd May 2008, 22:39
The reason why Avisynth and VirtualDub don't really support VFR is because the output format (AVI) does not support it either.
Set the framerate to the minimum common multiply of all framerates and insert nul frames to avi.
I do not believe that dupe detecting filters are really that beneficial (unless to remove teleciding), as a frame that is a dupe of the previous one should be able to be encoded very efficiently. If I want near-dupes to be dropped is mostly a matter of taste, but I'd rather be on the side of caution. Dropping 15% of real life content seems a bit overdoing it.
Have any tests been done where the benefit of dupe filters has been determined (where motion fluidity remains intact)?
Encode a clip to rmvb and play it in MPC. Carefully watch the framerate in stats and you will get the answer.
LoRd_MuldeR
22nd May 2008, 23:03
Instead of skipping frames, the encoder can use P-Frames to encode still scenes. If the current frame is almost identical to the previous one (and the encoder does a decent job) then the P-Frame will be VERY small in size. And it works without VFR, making any workarounds (like the proposed AVI hack) needless. Furthermore the encoder could check for almost identical frames, replace such frames with an exact copy of the previous frame and then encode them with P-Frames. This should make the P-Frames even smaller (no noise to encode) and still doesn't need VFR.
roozhou
22nd May 2008, 23:13
Instead of skipping frames, the encoder can use P-Frames to encode still scenes. If the current frame is almost identical to the previous one, then the P-Frame will be VERY small in size. And it works without VFR, making any workarounds (like the proposed AVI hack) needless.
P-frame can never be smaller than null frame.
Furthermore the encoder could check for almost identical frames, replace such frames with an exact copy of the previous frame and encode it with P-Frames. This should make the P-Frames even smaller (no noise to encode) and still doesn't need VFR.
Checking and encoding need much more CPU time than dedup filters. And not all video encoders are very effecient at encoding still scenes.
LoRd_MuldeR
22nd May 2008, 23:19
Well, a good encoder should produce extremely small P-Frames in still scenes (maybe by filtering out noise) that are not significantly bigger than "Null" Frames.
Saving a few bytes (and that only in some rare scenes) by using VFR and Null-Frames isn't worth all the problems that come with it...
GodofaGap
22nd May 2008, 23:32
Set the framerate to the minimum common multiply of all framerates and insert nul frames to avi.
Yes I'm aware of such methods. This is ok when the framerates are convenient (say NTSC film and NTSC TV). But trying to join unconvenient framerates that way (say PAL and NTSC TV) is going to cause massive overhead.
Encode a clip to rmvb and play it in MPC. Carefully watch the framerate in stats and you will get the answer.
Answer to what? Not to my question.
P-frame can never be smaller than null frame.
But the difference is negligible.
Checking and encoding need much more CPU time than dedup filters. And not all video encoders are very effecient at encoding still scenes.
Which ones? Do you have results?
roozhou
22nd May 2008, 23:42
I have hacked mencoder and now it generate an accurate timecode_v2 file for me. It is easy to do a VFR-in + VFR-out encoding with x264,vc1,xvid and any other vfw codecs and mux into avi, mkv, mp4, asf and flv. IMO VFR does help a lot encoding animes.
roozhou
22nd May 2008, 23:52
Yes I'm aware of such methods. This is ok when the framerates are convenient (say NTSC film and NTSC TV). But trying to join unconvenient framerates that way (say PAL and NTSC TV) is going to cause massive overhead.
Set it to 150
Answer to what? Not to my question.
Real Producer has a built-in dropdup filter. In still scenes framerate will drop to 10~20 fps.
I will make a few comparisons between cfr and vfr.
GodofaGap
23rd May 2008, 00:01
Set it to 150
That's hardly accurate since NTSC TV is 30000/1001 fps. Unless you fix the audio as well or add extra dupes you are creating a reasonably large error. There is simply not a reliable way of dealing with this in an automated manner.
BTW, if you really want to you can already do this manually with VirtualDub for a long time. You know, that crappy editor.
roozhou
23rd May 2008, 00:37
That's hardly accurate since NTSC TV is 30000/1001 fps. Unless you fix the audio as well or add extra dupes you are creating a reasonably large error. There is simply not a reliable way of dealing with this in an automated manner.
BTW, if you really want to you can already do this manually with VirtualDub for a long time. You know, that crappy editor.
What happens if you mux 10 fps movie into 31 fps avi?
Frame sequence 0123456789 will become 0--1--2--3--4--5--6--7--8--9--- (- stands for null frame). You don't need to fix audio and one can hardly distinguish this and perfect 10fps movie.
GodofaGap
23rd May 2008, 19:36
I tried it on a Simpsons capture I made yesterday and I must say the compression gain is higher than I expected. About 10% gain for about 15% of the frames removed (with x264 in crf mode). It was a lot slower though as the script was required to be done in a 2-pass mode. What dup removing method are you using?
roozhou
23rd May 2008, 21:18
I tried it on a Simpsons capture I made yesterday and I must say the compression gain is higher than I expected. About 10% gain for about 15% of the frames removed (with x264 in crf mode). It was a lot slower though as the script was required to be done in a 2-pass mode. What dup removing method are you using?
With avs script you have to do 2-pass coz avisynth expects accurate number of frames from each filter. I am now using mencoder+x264cli. The decimate filter in mencoder works in 1-pass mode(i hacked mencoder to make it output a timecode_v2 file).
I tested encoding the last 1/3 part of 360p Elephants Dream in x264 crf mode and 8% frames removed. And for Japanese animes at least 25% frames can be removed.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.