PDA

View Full Version : Converting RAW H264 to MP4 then MKV


VincentNguyen
6th November 2006, 21:35
Now here's my problem:
- I have a TS file, AC + MPEG2, 29.97FPS (or so DGIndex says). Playback like a charm, but big
- I encoded it to h264 using x264, with the following settings: 4000kbps, 2-pass; High Profile 4.1, output to RAW (and the last point was my mistake). Script was rather straightforward, since this content was 100% film (ie no deinterlacing needed)

I have a nice .264 file now... that can't be played anywhere (apart VLC, which chokes on it).

I'm trying to mux it to MKV back with the original AC3 track, following this procedure:

- mp4box -add input.264 output.mp4
- mkvmerge to mux them with the audio tracks

The resulting file has one big problem: audio gets out of sync very quickly, as it seems my framerate is not the original one

Video quality is superb, with no visual artifact, but audio is out of sync and framerate is clearly too fast.

I tried using the -fps 29.97 command, without success, audio is still out of sync
Tried using -fps 25, without success either

Could it be that my encoding has resulted into a different framerate ? Is there a way I can check the .264 framerate ?

VincentN

nm
6th November 2006, 22:04
How about -fps 23.976 since it's film. At least you seem to have done ivtc on it because there are no visual artifacts (or then you have deinterlacing enabled during playback).

VincentNguyen
6th November 2006, 23:25
Actually yes, using -fps 24 seems to have solved the sync problem. That said it could be that I have to set it up to 23.976, as I might end up with again the sync issue later in the movie.

That said I have now another problem: if I jump back and forth in the movie file, audio loses sync completely. I presume this is now a mux issue, since when I come back to the beginning of the movie, it's still out of sync (but when playing from the beginning it is not out of sync).

help appreciated

Vincent

foxyshadis
7th November 2006, 01:11
That's a player/decoder issue actually, if it plays back normally without seeking the player should play it the same way when seeking. Is this VLC or mplayer? If not, which player, splitter, and decoder? (All three interact in directshow.)

VincentNguyen
7th November 2006, 22:10
I'm using Windows Media Player (version 9 I believe). CoreAVC codec for video, AC3 filter for audio, Haali splitter

Other MKV files are playing fine on the exact same setup (same type of files actually, ie 1080 video stream + ac3 audio stream), and I can go back and forth.

Could this be an interleave issue ?

VincentNguyen
7th November 2006, 22:57
Digging further into it, this is highly frustrating.

The core of the issue is indeed a framerate issue. Using a powerful system, I was able to go back and forth and note that at the very beginning the audio was in sync, but not after 10 minutes or so.

I therefore used the -fps 29.976 as suggested by nm, and bingo the audio is in synch for a much longer period of time.

But I still get half a second delay after one hour of playback... at the end this result into the file being one second off for a two hours film, and obviously the audio is not synced anymore.

Any other framerate I should try ? Is this because mp4box has an issue with the -fps command ? How to check the original fps of the RAW file (oddly enough the original TS is 29.97) ?

foxyshadis
7th November 2006, 23:17
Yes, 29.976 will cause a 3/4 second desynch after an hour. You're combining film and video framerates in an odd way.

Video: 29.97 (29.9700299700...)
Film: 23.976 (23.9760239760...)

VincentNguyen
7th November 2006, 23:57
Correction, I should have said that I used 23.976 in my last reply. This result in audio being out of sync of one sec after two hours.