I'm having a very frustrating problem with one of my video files. I would like to convert it from mkv to mp4 but it loses audio syncronisation for mysterious reasons. I usually use mkvtoolnix to demux and yamb/mp4box to remux in mp4. I have tried many many builds of both and the resulting video always has sync problem. The sync problems persist even if I just try to remux the extracted streams into a new mkv (using mkvtoolnix for both demux and remux). After further analysis I think the problem lies in the fact that media info reports the initial mkv as having 131090 frames and once I demux the h264 video stream, whether I import it into an mkv or an mp4 it'll always report 131109 frames, with 19 added frames somehow. No version of mkvtoolnix that I have tried could demux that video stream to be 131090 frames. TSmuxer also demuxes it to be 131109 frames...
Importing the original mkv into avidemux also shows that 131109 number of frames. Does someone know what is going on? Why is there a discrepancy in number of frames? Was the original h264 stream shrunk with the "stretch by" option in mkvmerge? Is there any program out there that can read the "stretch by" and audio delay attributes within an mkv container header?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 19 of 19
Thread
-
-
Maybe https://forum.videohelp.com/threads/334884-MKV-to-MP4-audio-stretch-issues!!! will work.
-
Thanks but unfortunately I can't use xvid4psp on my computer, it requires netframework 3.0 and I can't install that on my computer (long story). The poster in that topic said ffrebuilder solved his problem and xvid4psp seems to just be a GUI for ffrebuilder and other tools but I haven't been able to find a standalone version of ffrebuilder.
Also, does anyone know why the mkv extraction tools would extract a different number of video frames than media info reports the initial video has? I think my problem isn't about stretched audio, but somehow a badly extracted video stream. -
Sure thing, this is the original MKV with 132090 frames: (oops, I just realized I made a mistake of 1000 frames in my initial post but the discrepancy is still 19 frames, 132090 VS 132109)
General #0
Count : 178
Count of stream of t : 1
Kind of stream : General
StreamKindID : 0
Count of video strea : 1
Count of audio strea : 1
Count of text stream : 4
Count of chapter str : 1
Codecs Video : MPEG-4 AVC
Video_Language_List : English
Audio codecs : AC3
Audio_Language_List : Japanese
Text codecs : VobSub / VobSub / VobSub / VobSub
Text_Language_List : English / French / Spanish / Portuguese
Chapters_Language_Li : English
Complete name : G:\Tokyo Godfathers.mkv
Folder name : G:
File name : Tokyo Godfathers
File extension : mkv
Format : Mk
Format : Mk
Codec : Mk
Codec : Mk
File size : 1005221751
File size : 959 MiB
File size : 959 MiB
File size : 959 MiB
File size : 959 MiB
File size : 958.7 MiB
PlayTime : 5509262.000
PlayTime : 1h 31mn
PlayTime : 1h 31mn 49s 262ms
PlayTime : 1h 31mn
PlayTime : 01:31:49.262
Bit rate : 1459682
Bit rate : 1460 Kbps
Encoded date : UTC 2008-11-22 03:26:17
Writing application : mkvmerge v2.4.0 ('Fumbling Towards Ecstasy') built on Oct 11 2008 20:22:12
Writing library : libebml v0.7.8 + libmatroska v0.8.1
Cover : Yes
Video #0
Count : 77
Count of stream of t : 1
Kind of stream : Video
StreamKindID : 0
ID : 1
UniqueID : 1
Codec : V_MPEG4/ISO/AVC
Codec : MPEG-4 AVC
Codec/Info : MPEG4 ISO advanced profile
Codec/Url : http://ffdshow.sourceforge.net/tikiwiki/tiki-index.php?page=Getting+ffdshow
PlayTime : 5503750
PlayTime : 1h 31mn
PlayTime : 1h 31mn 43s 750ms
PlayTime : 1h 31mn
PlayTime : 01:31:43.750
Width : 688
Width : 688 pixels
Height : 384
Height : 384 pixels
Pixel Aspect Ratio : 1.000
Display Aspect ratio : 1.792
Display Aspect ratio : 16/9
Frame rate : 23.976
Frame rate : 23.976 fps
FrameCount : 132090
Language : en
Language : English
Audio #0
Count : 62
Count of stream of t : 1
Kind of stream : Audio
StreamKindID : 0
ID : 2
UniqueID : 2
Codec : A_AC3
Codec : AC3
Codec/Info : Dolby AC3
Channel(s) : 6
Channel(s) : 6 channels
Sampling rate : 48000
Sampling rate : 48 KHz
SamplingCount : 264444576
Language : ja
Language : Japanese
Text #0
Count : 53
Count of stream of t : 4
Kind of stream : Text
StreamKindID : 0
ID : 3
UniqueID : 3673329857
Codec : S_VOBSUB
Codec : VobSub
Codec/Info : The same subtitle format used on DVDs
Language : en
Language : English
Text #1
Count : 53
Count of stream of t : 4
Kind of stream : Text
StreamKindID : 1
ID : 4
UniqueID : 400480429
Codec : S_VOBSUB
Codec : VobSub
Codec/Info : The same subtitle format used on DVDs
Language : fr
Language : French
Text #2
Count : 53
Count of stream of t : 4
Kind of stream : Text
StreamKindID : 2
ID : 5
UniqueID : 2152038064
Codec : S_VOBSUB
Codec : VobSub
Codec/Info : The same subtitle format used on DVDs
Language : es
Language : Spanish
Text #3
Count : 53
Count of stream of t : 4
Kind of stream : Text
StreamKindID : 3
ID : 6
UniqueID : 1174871521
Codec : S_VOBSUB
Codec : VobSub
Codec/Info : The same subtitle format used on DVDs
Language : pt
Language : Portuguese
Chapters #0
Count : 46
Count of stream of t : 1
Kind of stream : Chapters
StreamKindID : 0
Language : en
Language : English
1 : 00:00:00.000 Start
2 : 00:08:36.140 Guardians for a Night
3 : 00:12:04.974 Gin's Past
4 : 00:14:10.766 Second Thoughts
5 : 00:16:46.688 The Key
6 : 00:17:30.507 Something Smelss
7 : 00:20:50.958 The Cemetery
8 : 00:23:09.554 Blocking a Public Thoroughfare
9 : 00:25:33.039 His Daughter's Wedding
10 : 00:26:47.222 "Her Name's Sachiko."
11 : 00:27:46.539 Kidnapped
12 : 00:29:49.496 "We're Not Action-Movie Heroes."
13 : 00:33:32.760 Last Request
14 : 00:35:30.002 The Nursing Station
15 : 00:36:26.809 New Year's Cleanup
16 : 00:37:58.059 Miyuki's Past
17 : 00:40:54.827 Lost Children Found
18 : 00:45:31.078 Hana's Past
19 : 00:52:02.502 The Neighbors Remember
20 : 00:54:52.914 A Child Never Forgets Its Parents
21 : 01:00:33.246 Gin's Daughter
22 : 01:05:38.142 The Weeping Red Devil
23 : 01:08:02.703 Sachiko
24 : 01:10:41.320 Sachiko's Husband
25 : 01:16:08.080 In Pursuit of Stolen Goods
26 : 01:22:03.702 "I Want to be Reborn."
27 : 01:24:32.776 Hana Saves the Baby
28 : 01:25:29.749 The Final Miracle -
And this is a test remux done with mkvtoolnix, a simple extract of the video and audio stream and a remux (ending with 132109 frames):
General #0
Count : 178
Count of stream of t : 1
Kind of stream : General
StreamKindID : 0
Count of video strea : 1
Count of audio strea : 1
Count of text stream : 0
Count of chapter str : 0
Codecs Video : MPEG-4 AVC
Audio codecs : AC3
Complete name : G:\Tokyo Godfathers_remux.mkv
Folder name : G:
File name : Tokyo Godfathers_remux
File extension : mkv
Format : Mk
Format : Mk
Codec : Mk
Codec : Mk
File size : 998438388
File size : 952 MiB
File size : 952 MiB
File size : 952 MiB
File size : 952 MiB
File size : 952.2 MiB
PlayTime : 5510088.000
PlayTime : 1h 31mn
PlayTime : 1h 31mn 50s 88ms
PlayTime : 1h 31mn
PlayTime : 01:31:50.088
Bit rate : 1449615
Bit rate : 1450 Kbps
Encoded date : UTC 2011-05-22 04:13:23
Writing application : mkvmerge v4.0.0 ('The Stars were mine') built on Jun 6 2010 16:18:42
Writing library : libebml v1.0.0 + libmatroska v1.0.0
Video #0
Count : 77
Count of stream of t : 1
Kind of stream : Video
StreamKindID : 0
ID : 1
UniqueID : 2036307623
Codec : V_MPEG4/ISO/AVC
Codec : MPEG-4 AVC
Codec/Info : MPEG4 ISO advanced profile
Codec/Url : http://ffdshow.sourceforge.net/tikiwiki/tiki-index.php?page=Getting+ffdshow
PlayTime : 5504541
PlayTime : 1h 31mn
PlayTime : 1h 31mn 44s 541ms
PlayTime : 1h 31mn
PlayTime : 01:31:44.541
Width : 688
Width : 688 pixels
Height : 384
Height : 384 pixels
Pixel Aspect Ratio : 1.000
Display Aspect ratio : 1.792
Display Aspect ratio : 16/9
Frame rate : 23.976
Frame rate : 23.976 fps
FrameCount : 132109
Audio #0
Count : 62
Count of stream of t : 1
Kind of stream : Audio
StreamKindID : 0
ID : 2
UniqueID : 1673317288
Codec : A_AC3
Codec : AC3
Codec/Info : Dolby AC3
Channel(s) : 6
Channel(s) : 6 channels
Sampling rate : 48000
Sampling rate : 48 KHz
SamplingCount : 264484224 -
so mkvextract and then mkvmerge back into mkv will show the framecount difference ?
some encoding options (open gop) are not compatible with current mp4 container specs , but that doesn't explain the frame count discrepancy; it just can cause sync and seek issues. The metadata is missing as well (I'm assuming x264 was used to encode the mkv ?)
try muxing with ffmpeg without mkvextract
ffmpeg -i input.mkv -vcodec copy -acodec copy output.mp4
The other possibility is VFR . You would have to mux in timecodes to the mp4 container, but that doesn't explain framecount difference eitherLast edited by poisondeathray; 24th May 2011 at 12:23.
-
Hmm... Here's the command line I used:
"C:\Documents and Settings\xxx...\FFmpeg\FFmpeg-git-N-30172-g3c20c0e\ffmpeg.exe" -i "G:\Tokyo Godfathers.mkv" -vcodec copy -acodec copy "G:\output.mp4"
The resulting mp4 took like half a second to "mux" and ended up being 16KB and of course non usable. What's wrong? -
I've never used ffmpeg before and I can't find the log
I'm suspecting I'm doing something wrong with ffmpeg because I tried on another mkv file I had and a straight mkv to mkv copy done on ffmpeg didn't work either...
I've cut down the original mkv to a 20MB piece with only the audio and video (no demuxing, a straight edit cut from mkvtoolnix while only retaining the video and audio streams). Media info shows it as having 3043 frames, but again once extracted it shows 3050 frames. The piece is only 20MB, if anyone would like to download it and tell me what they think of that problem, I'd really appreciate it.
Here's a link:
http://www.megaupload.com/?d=9YHARLSI
Alternate link in case:
http://www.mediafire.com/?2xdp6p2w462hyytLast edited by PlanetIndigo; 24th May 2011 at 13:53. Reason: Alternate Link
-
Yeah, for some reason the first link seems to be acting up, it worked at first, then didn't work and now it works again. I uploaded it to mediafire as a backup option.
-
I wanted to remux it into mp4 for my PS3. I've had a couple issues with audio sync in mkv --> mp4 in the past, but I'm not sure if those were caused by a discrepancy in the video frame # as this is the first time I've actually taken notice of this.
Out of curiosity, are you using a GUI for eac3to? If so, which one would you recommend?
Also, did you try ffmpeg on that video and did it produce an mp4 with 3050 video frames as well? -
I used command line for eac3to and ffmpeg
all attempts to demux or re-wrap with multiple programs resulted in 3051, not 3050
raw elementary stream parsers indicate 3051 frames
I think the fps is a bit off in that file (it's not perfect 24000/1001) , and the timecodes suggest this as well . But even muxing with timecodes or modified timecodes result in different figures
Either it's damaged, or the person who made it didn't do a good job . I would leave it as is; I don't see a way around it -
I'm not very familiar with how to read timecodes, for future reference, what made you say in those timecodes that the fps shouldn't be 23.976?
Also, assuming that the file isn't damaged, how would someone would go at encoding a video file that shows X number of frames once in a container then a different x+y number once the video stream was demuxed? Is it what the "stretch by" field do for a video stream in mkvmerge? (I take it it doesn't modify the fps since it's an entirely different option so it would duplicate or remove some frames maybe?)
PS: I was saying 3050 frames because when I was extracting the streams from the sample I posted then remuxing them into a a new mkv, media info was reporting the new mkv as having 3050 frames. Now that I paid attention to the number reported in TS muxer when it demuxes the initial track it shows it extracted 3051 frames like you said. The oddities continue... -
Well mediainfo isn't necessarily correct. I wouldn't go by that. It just reads header information and can be wrong.
A stream parser will examine every frame, and is more accurate
I'm saying if done properly, it should be 24000/1001 , not 23.976 which is an approximation
but this video is reported by directshow (in avisynth) to be 1000000/417083 , which is close . This reports 3044 through directshow
other programs report 3051 frames and fps to be 24101/1001 or fps 24.0799
Both are probably wrong from the original source that this was encoded from. You can bet money that the original source was 24000/1001
If you look at the timecodes when demuxed with mkvextract, or use ffms2 in avisynth to print the timecodes you will see irregularities, like repeats
eac3to also reports errors
the stretch field won't do anything , because that's a linear stretch, so you make one part in sync, but other parts out of sync.
You can try those odd values for the fps field, they might work -
Well, I have given up on that video. After tinkering with it and skewing the audio then adjusting the fps slightly up (23.978), I had the beginning and the end synced but the middle was off, so it's definitely not a straight stretch...
Despite not being successful with fixing this vid, I want to thank you a lot poisondeathray for all your help, much appreciated!
Similar Threads
-
MKV to MP4 encoding_hardsubbing and audio sync problems.
By Alcatraz in forum Newbie / General discussionsReplies: 11Last Post: 16th Mar 2012, 15:34 -
How To Cut MKV Without Audio/Video Sync Problems
By Eva-Unit01 in forum Video ConversionReplies: 12Last Post: 2nd Mar 2011, 08:11 -
Sync problems after merging mkv video with mp3 audio
By billman1234 in forum Video ConversionReplies: 5Last Post: 29th Jun 2010, 15:00 -
MKV chapter file extraction problems
By ikarishinji41 in forum EditingReplies: 1Last Post: 22nd Mar 2010, 11:03 -
Audio Sync problems with MKV file using WMP
By jradams76 in forum Software PlayingReplies: 0Last Post: 23rd Jul 2007, 11:51