Log in

View Full Version : Converting a .m2ts containing VFR AVC into mp4/mkv


GG-Xtreme
11th January 2011, 06:14
I feel like an idiot when it comes to this stuff. After sorting out my other issues, I came across an odd video file: a 4GB, 1080p .m2ts that contained a variable-framerate H.264 stream and an AC3 track. The video plays fine in VLC (although seeking and time are completely broken, video appears as 00:00:00 in length and dragging the seek bar has no effect), and even plays fine in Windows Media Player (seeks fine and shows correct length).

I can't figure out how to turn this into a CFR mp4 or mkv. Every .m2ts converter I've tried seems to be looking for a large Bluray-format video stream and fails to load the file. Demuxing the .m2ts only gives me a raw .h264 file without timecodes or anything--useless, as I can only specify constant framerates when muxing.

I tried loading the .m2ts directly into MeGUI to convert to constant-framerate, and it loads fine...using DirectShowSource, which has been so-far useless to me, since the encoded files do not seek or play properly on Android phones or in MPC. Attempting to use FFmpegSource with the file just crashes MeGUI. Is there any other method of turning this .m2ts file into any constant-framerate format?

roozhou
11th January 2011, 17:04
Why do you need to convert VFR to CFR?

GG-Xtreme
11th January 2011, 22:07
Because my Android phone can't play VFR with hardware acceleration without going way out of sync (seems to be a limitation in the hardware or firmware). Not to mention that it can't play .m2ts files anyway.

LoRd_MuldeR
11th January 2011, 23:49
I feel like an idiot when it comes to this stuff. After sorting out my other issues, I came across an odd video file: a 4GB, 1080p .m2ts that contained a variable-framerate H.264 stream and an AC3 track.

Where exactly did you get that kind of file?

Selur
12th January 2011, 00:15
A sample would be nice. :) I have never seen such a stream would probably like some other users have a look at it. :)
btw. did you try to feed it directly to x264 with '--force-cfr' activated?

sneaker_ger
12th January 2011, 00:34
btw. did you try to feed it directly to x264 with '--force-cfr' activated?

If the source really is VFR this would destroy the sync (assuming all this option does is to make x264cli generate the timecodes itself?). But I have to admit that I have never come across a VFR m2ts myself.

What I find strange is that he says that using DirectShowSource will make the output not seek or play properly while the source filter used in an AviSynth script shouldn't have any impact on things like these at all.

GG-Xtreme
13th January 2011, 20:02
Where exactly did you get that kind of file?
I had a friend at my dorm rip some of my Blurays for me and put them on my external hard drive, since I don't have a PC Bluray drive for ripping stuff myself. I should ask him what the hell he did.

A sample would be nice. :) I have never seen such a stream would probably like some other users have a look at it. :)
btw. did you try to feed it directly to x264 with '--force-cfr' activated?
How would I get a sample of this file? (I'm have no idea how to convert it, much less trim it) I didn't try the --force-cfr option, I'll look into it.

What I find strange is that he says that using DirectShowSource will make the output not seek or play properly while the source filter used in an AviSynth script shouldn't have any impact on things like these at all.

I think this is weird myself. However, testing on 2 different PC's for encoding and 2 different phones for playback, the same exact source video had serious playback and seek issues if encoded with DirectShowSource, but had no problems if encoded with the same settings (H.264, resolution, quality, framerate, etc.) using FFVideoSource instead. The problem remained for any source videos I tried (and I tried a good 20 or so videos before I realized that using FFVideoSource resolved the problems).