Log in

View Full Version : Editing/converting VFR MP4 without encoding.


eddman
27th February 2012, 17:40
These VFR MP4 files are giving me a lot of headache. I can't seem to find a way to properly edit and/or convert them. The video and audio get out of sync.

I tried avidemux 2.5.x, but it can't handle VFR.
Then tried 2.6.x, but apparently the end result is somehow corrupted. Video plays for 2-3 seconds, then stops, but audio keeps going.

1. Is there a way to edit VFR MP4s without encoding? Is there a software besides avidemux? or maybe a combination of different software to do it?

2. If editing VFR isn't possible, then how can I convert them to CFR MP4 or MKV? Editing CFR is much easier.

3. If it's not possible to do those things without encoding, then what's the correct way to encode VFR to CFR?

sneaker_ger
27th February 2012, 17:55
1. Try mkvmerge, then demux and reconvert to mp4 afterwards
2. only re-encoding (unless all the parts you want to use happen to have the same framerate)
3. AviSynth: ffvideosource("source.mp4", fpsnum=x, fpsden=y)

eddman
27th February 2012, 18:17
1. Try mkvmerge, then demux and reconvert to mp4 afterwards
2. only re-encoding (unless all the parts you want to use happen to have the same framerate)
3. AviSynth: ffvideosource("source.mp4", fpsnum=x, fpsden=y)

I'm new to video editing and encoding so let's see if I got these right:

1. You're saying I convert the VFR MP4 to VFR MKV, edit it, and then convert it back to MP4.
What difference does that make? Are you suggesting that editing VFR MKV is possible? Can avidemux 2.6 edit VFR MKV properly? or maybe you had some other editing software in mind?

2. Ok, it seems that the only way to convert VFR to CFR is re-encoding, which I'd rather not do cause it'd degrade the quality.

3. I'm not familiar with AviSynth and ffvideosource at all. Is there a guide?

sneaker_ger
27th February 2012, 18:56
1. You're saying I convert the VFR MP4 to VFR MKV, edit it, and then convert it back to MP4.

No, I'm saying that mkvmerge has the ability to cut and cat (read: edit) VFR files. It just happens to only output mkv files (but supports mp4 input), so you'll get an mkv file as the result.

3. I'm not familiar with AviSynth and ffvideosource at all. Is there a guide?

1. Download and install AviSynth
2. Download ffmpegsource and copy the plug-in to AviSynth's plugin directory
3. create a text file in the same folder as the video file and name it "whatever.avs"
4. open the file in e.g. notepad and enter:
"ffvideosource("source.mp4", fpsnum=x, fpsden=y)"
5. Replace x and y according to your desired CFR framerate (e.g fpsnum=24000 and fpsden=1001 for 23.976 fps)
6. Encode the file with x264. You can use one of the many GUI's out there for that job (like MeGUI etc.)



I saw this thread which deals with an editor that supposedly handles VFR files, but it is shareware and I have not tested it:
http://forum.doom9.org/showthread.php?t=163985

eddman
27th February 2012, 19:14
No, I'm saying that mkvmerge has the ability to cut and cat (read: edit) VFR files. It just happens to only output mkv files (but supports mp4 input), so you'll get an mkv file as the result.

Ah, ok, but I don't see any editor in mkvmerge, only a chapter editor which I suppose isn't what I want, or is it?

Anyway, it seems that I managed to solve my problem. I converted the MP4 to MKV with mkvmerge. Then edited (cropped) it with avidemux 2.6 and then saved the result without re-encoding to MP4 format. Apparently it did the trick, but I need to test further to see if any issues might rise. For now it seems to be ok.

Thanks very much for your help, although I'm sure I'll be needing it again soon. :D This beta avidemux is really buggy and unstable.

EDIT: Well, it seems editing the MKV with avidemux and then outputting it as MP4 results in a non accurate file. Outputting it as MKV looks frame accurate. I'll try to convert the final MKV to MP4 with another program later, see what happens.