Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd August 2010, 18:10   #1  |  Link
Shinji-kun
Registered User
 
Join Date: Aug 2010
Posts: 82
MKV to MP4 Without quality Loss (Audio/Video Sync Issues)

I am trying to remux a ~23 min. video (MKV container/AVC) to an easier to edit container, in order to cut a 3-5 minute clip from it and upload it to the internet.

So far I have tried:

- Opening the MKV in Avidemux and trying to save the 3 minute selection.

- Opening the mkv in Virtualdubmod w/ avisynth and trying to save the selection as an Xvid AVI.

- Extracting the contained files with MKVextractGUI and remuxing them to:
- an mp4 file with my mp4box gui.
- an mkv with just the single audio and subtitle files I wanted to be in the clip.


In every case the resulting video file experienced the same problem: severe audio/video sync problems. When I tried just opening the MKV file (in avidemux or vdm) to edit it directly, the audio was to late. When i tried remuxing it to an mp4, the audio was too far ahead of the video.

Whatever I try there is always the same problem with the audio/video being out of sync. I have tried other video forums, but the posters just go around in circles. The closest I've come to solving this issue is by remuxing the mkv to an mp4 in my mp4box gui. Although the audio and subtitles are completely synced, the video and audio are not.

This problem keeps recurring with all mkv/H264 files I attempt to convert or remux. I don't know whether the issue is with the laughable mkv support that is currently available or if my computer is just being hacked by some loser trying to screw up the conversion every single time, but MKV/H264 files are the only videos i've had trouble successfully converting and uploading to a streaming site.

So if anyone coudl give any advice that would actually solve this repeated problem, thanks in advance.
Shinji-kun is offline   Reply With Quote
Old 23rd August 2010, 18:18   #2  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by Shinji-kun View Post
I am trying to remux a ~23 min. video (MKV container/AVC) to an easier to edit container, in order to cut a 3-5 minute clip from it and upload it to the internet.
Cut with mkvmerge --split or with mkvmerge GUI.
nm is offline   Reply With Quote
Old 23rd August 2010, 19:02   #3  |  Link
Shinji-kun
Registered User
 
Join Date: Aug 2010
Posts: 82
Quote:
Originally Posted by nm View Post
Cut with mkvmerge --split or with mkvmerge GUI.
I tried checking the "enable splitting" box in the global tab in mkvmerge. I used the split by time code option, specified the exact durations, and it split the video into 3 files, the 2nd of which was the closest to the clip I wanted, but still the audio was out of sync. The cuts weren't even close enough to the durations I typed. Instead of the selection i wanted being contained entirely in the second video, the first half of the clip was at the end of the 2nd video and the remaining portion was at the beginning of the 3rd video. This, though, is clearly not what I was aiming to do.
Shinji-kun is offline   Reply With Quote
Old 23rd August 2010, 19:48   #4  |  Link
b66pak
Registered User
 
b66pak's Avatar
 
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
make a .bat file like this:

Code:
mkvmerge -o my_video-part.mkv my_video.mkv --split 00:01:30 --split 00:03:45 --split-max-files 3
edit my_video.mkv with your file name and my_video-part.mkv with the desired final name.

also edit the beginning of the cut (00:01:30) and the end of the cut (00:03:45) in this format: HH:MM:SS (hours:minutes:seconds).

Your cut will be named my_video-part-002.mkv.

N.B. mkvmerge will cut the video at the first IDR frame AFTER the desired time!
_
__________________
if you ask a question and somebody give you the correct answer don't forget to leave a "thank you" note...
Visit The Land Of Dracula (Romania - EU)!

Last edited by b66pak; 23rd August 2010 at 19:57.
b66pak is offline   Reply With Quote
Old 23rd August 2010, 19:54   #5  |  Link
Shinji-kun
Registered User
 
Join Date: Aug 2010
Posts: 82
People, use coherent grammar.
Shinji-kun is offline   Reply With Quote
Old 23rd August 2010, 19:58   #6  |  Link
b66pak
Registered User
 
b66pak's Avatar
 
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
excuse the speed...
_
__________________
if you ask a question and somebody give you the correct answer don't forget to leave a "thank you" note...
Visit The Land Of Dracula (Romania - EU)!
b66pak is offline   Reply With Quote
Old 23rd August 2010, 20:15   #7  |  Link
Shinji-kun
Registered User
 
Join Date: Aug 2010
Posts: 82
Quote:
Originally Posted by b66pak View Post
make a .bat file like this:

Code:
mkvmerge -o my_video-part.mkv my_video.mkv --split 00:01:30 --split 00:03:45 --split-max-files 3
edit my_video.mkv with your file name and my_video-part.mkv with the desired final name.

also edit the beginning of the cut (00:01:30) and the end of the cut (00:03:45) in this format: HH:MM:SS (hours:minutes:seconds).

Your cut will be named my_video-part-002.mkv.

N.B. mkvmerge will cut the video at the first IDR frame AFTER the desired time!
_
What do you mean? Do you mean to use time code for every single split or just broaden the start and end times for the selection that I want to cut.

The video is 23 minutes long. I want to cut a selection from 00:03:53 to 00:06:23. I assume the 2nd of the 3 mkv files should contain the footage from 00:03:53 to 00:06:23. Yet when I watch the 2nd mkv file in MPC the audio is still out of sync and the footage at the beginning of the file is ahead of where I indicated (00:03:53). What might the problem be?
Shinji-kun is offline   Reply With Quote
Old 23rd August 2010, 20:26   #8  |  Link
b66pak
Registered User
 
b66pak's Avatar
 
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
Quote:
mkvmerge -o my_video-part.mkv my_video.mkv --split 00:01:30 --split 00:03:45 --split-max-files 3
this mean you will end up with 3 files (--split-max-files 3): first 00:00:00 to 00:01:30, second 00:01:30 to 00:03:45 and third 00:03:45 to end of file!

Quote:
the footage at the beginning of the file is ahead of where I indicated (00:03:53)
use 00:03:50 or lower!
__________________
if you ask a question and somebody give you the correct answer don't forget to leave a "thank you" note...
Visit The Land Of Dracula (Romania - EU)!
b66pak is offline   Reply With Quote
Old 23rd August 2010, 23:11   #9  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
About the cuts not being exactly where specified: please note that mkvmerge cuts at the nearest keyframes - otherwise the video would be broken at the cuts. You cannot cut at non-keyframes without reencoding.
About the audio/video desync: you're saying that
a.) your mkv files are perfectly in sync, but
b.) after cutting with mkvmerge they are not?
That would be the first time for me to ever hear about such a problem. If you try b66pak's suggestion (using the global tab in the GUI should have the same result as using the commandline) on your original, still-in-sync files (not the demuxed or remuxed streams), I'm pretty sure the resulting files will be fine.

Why demuxing and remuxing destroys the sync between video and audio but not between audio and subtitles: you're probably dealing with variable framerate content (often anime) and did not take care of the timecodes thus destroying the sync.
sneaker_ger is offline   Reply With Quote
Old 9th September 2010, 19:24   #10  |  Link
Shinji-kun
Registered User
 
Join Date: Aug 2010
Posts: 82
Quote:
Originally Posted by sneaker_ger View Post
Why demuxing and remuxing destroys the sync between video and audio but not between audio and subtitles: you're probably dealing with variable framerate content (often anime) and did not take care of the timecodes thus destroying the sync.
Cutting the original file seemed to work although the audio gets progressively out of sync. The greater in duration the clip is, the more out of sync it gets. The video is VFR.
Shinji-kun is offline   Reply With Quote
Old 9th September 2010, 19:48   #11  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
If you have respected the following things, it should've worked:
1.) your original file is definitely in perfect sync over the whole time line
2.) you opened that original file in mmg
3.) you only used mmg for cutting using the "global" tab
4.) you did not set any "fps" in mmg (otherwise the timecodes from the original file will be overwritten) (<- maybe this?)
5.) you're using the same player for both the original and the cutted file

if you have respected all of the above and the file is still out of sync it could have one of the following reasons:
a.) your original file is broken
b.) you've found an error in mkvmerge
c.) your player is broken in some way or too slow (<- probably not this)
sneaker_ger is offline   Reply With Quote
Old 9th September 2010, 20:03   #12  |  Link
b66pak
Registered User
 
b66pak's Avatar
 
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
also use the last mkvtoolnix (4.3.0)...
_
__________________
if you ask a question and somebody give you the correct answer don't forget to leave a "thank you" note...
Visit The Land Of Dracula (Romania - EU)!
b66pak is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:14.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.