PDA

View Full Version : How to demux variable framerate (vfr) mp4? (vfr to cfr)


Robotik
24th August 2007, 00:39
hi all,

i'd like to demux video from a variable frame rate mp4 to a constant frame rate avi container.
yamb demuxes, but the video i get doesn't match the audio (those frames that supposed to add delay inside the video are appearing as normal-length frames in the resulting avi)
how can this be done properly without re-encoding the video?

i need to do all this so that the file plays on my standalone, so the container must be old fashioned avi, and also the audio has to be re-encoded before remuxing.

the video is Xvid by the way and plays fine on my standalone except for i can't get it syncronized with the audio. it would be also ok if i could keep it variable framerate througout the whole process, but i think avi doesn't support vfr.

thank you for your help,
robotik

Dark Shikari
24th August 2007, 05:02
Where did you get this file? Why don't you make a rip from the original video source (I assume a DVD or such) and keep the constant framerate from that?

Robotik
24th August 2007, 14:52
it is a tv program i taped years ago and a friend's friend converted it to mp4 for me. the tape had been recorded over, so it's not that simple.

it seems every time there is a cut a few-frame-length delay is added to the video, but not to the audio, and most of the time there is a new keyframe there, but not all the time. anyway, it is in sync with the audio that way, but not after i demuxed it.

i tried to chop up the video and add those delays by inserting blank video snippets, but it doesn't work were there is no keyframe between the takes.

[P]ako
24th August 2007, 16:52
You will need to reencode the video or, if your standalone player supports matroska, mux it into a MKV.

Robotik
24th August 2007, 23:46
thanks, but how do i do that? during demuxing the time value gets lost, so after demuxing each frame represents 1/25 second, so however i mux it, the delays won't work, and sync gets screwed.

is there any tool that demuxes directly to mkv, or takes care of the delays any other way?

Robotik
25th August 2007, 00:05
or, alternatively, as the other method seems to be working, is there any tool that lets me insert a keyframe when i cut?

[P]ako
25th August 2007, 06:57
To mux it, use Graphedit, open it and insert the filter:

Directshowsource/haali matroska muxer (pick a location and a name when prompted)

Then go to file and render the media file (i.e. the vfr mp4). It should "automagically" connect the different streams contained in the MP4 to the MKV filter. Click the "play" button and wait for just a few seconds. It should create a MKV in perfect sync.

To reencode it, use avisynth and import the file as follow:

directshowsource("c:\lalala\vfr.mp4", fps=23.976, convertfps=true, audio=false)

Encode to lossless and from lossless encode to xvid. Demux the audio from the mp4 and transcode it to mp3 and mux with the video in an avi container.

As to your very last question, there is no tool to my knowledge that let you insert a frame wherever you please without reencoding, unless every single frame is a key frame.

Robotik
25th August 2007, 23:53
wow, you're a shaman. thank you.
i'll do it as soon as i understand it (i guess i have to re-read it a few times ;))
anyway, thanks again