AnimeSuki Forums

Register Forum Rules FAQ Community Today's Posts Search

Go Back   AnimeSuki Forum > Support > Tech Support

Notices

Reply
 
Thread Tools
Old 2008-01-10, 15:25   Link #1
LostSamurai
Junior Member
 
Join Date: Jan 2008
MKV to MP4/using AviSynth/Problem with H264

So for some time i've been looking into a guide to convert a MKV to MP4 (with subtitles), I found one on animesuki and thought I finally had it. However I ran into a problem.

First I use MKVExtract and extract all of the audio/video/subtitles from the video I want to convert.

Then I create a small script for AviSynth that looks like this as suggested.

LoadPlugin("C:\Program Files\K-Lite Codec Pack\Filters\vsfilter.dll")
DirectShowSource("C:\Documents and Settings\User\My Documents\MKVextracted\[SS-Eclipse] Hayate no Gotoku! - 01 (1280x720 h264) [6E15D0F0].0.mkv")
TextSub("C:\Documents and Settings\User\My Documents\MKVextracted\[SS-Eclipse] Hayate no Gotoku! - 01 (1280x720 h264) [6E15D0F0]_Track3.ass")

Problem is that when I used MKVExtract
I also got
[SS-Eclipse] Hayate no Gotoku! - 01 (1280x720 h264) [6E15D0F0]_Track1.h264 (217mb in size)
[SS-Eclipse] Hayate no Gotoku! - 01 (1280x720 h264) [6E15D0F0].0.mkv (17mb in size)

I'm converting the .avs file with PS3 Video 9.

Using the script doesn't work because the MKV file only has 1:32 of audio/video.
If I substitue the MKV for the H264 in the .AVS file and convert, it still only converts 1:32.

I played the .avs file in MPC (with the MKV) and it plays the first 1:32 and then after that the screen turns gray, only subtitles show up, no audio or video.
I played the .avs file in MPC (using the H264) and there is only 1:32 and nothing after that.

I apologize for the poor explanation and I am a novice when it comes to this. I was hoping someone could help me fix this or suggest another thread with a not so difficult method (like i thought this method was).
LostSamurai is offline   Reply With Quote
Old 2008-01-10, 17:38   Link #2
Eviltape
Senior Member
 
 
Join Date: Oct 2007
Location: Florida, USA
I've always heard of a way to extract the video and audio streams from an MKV and just put it in a MP4. I think this is how it goes...

Demux (meaning: seperate and extract) all of the streams of the MKV with MKVExtract GUI and put them somewhere, then use YAMB to mux them back into an MP4. Painless and requires no reencoding or Avisynth.
Eviltape is offline   Reply With Quote
Old 2008-01-10, 17:56   Link #3
LostSamurai
Junior Member
 
Join Date: Jan 2008
well... it is a quick painless method and it does let me convert the
h264 file into a .mp4 one but i get no audio or subtitles.

i tried using avisynth to add the subtitles. which did work but adding the .ogg audio stream... i have no clue. *browses the internet*

thanks for the suggestion though. YAMB has enabled me to get much farther without losing video quality or waiting 40 minutes for a conversion.

i'm guessing i could just convert the mkv using PS3 video 9
then use avisynth to hardcode the subtitles and then convert it again at this point and have audio/video/subtitles. although it seems a lengthy process... i don't know why i didn't think of it sooner but... i would prefer to just find a command to enter into .avs to add the .ogg stream.

edit: yeh it works if i convert the .mkv into .mp4 using ps3 video 9 and then use the avisynth script to add the subtitles and then load the .avs into ps3 video 9 for conversion. i tried it on a sample file but it would take 2 hours for 1 mpeg-2 HD fully converted file and 4 hours for 1 mpeg-4 fully converted file. has to be a way to add the audio into .avs or something so i can do 1 conversion process?

Last edited by LostSamurai; 2008-01-10 at 18:14.
LostSamurai is offline   Reply With Quote
Old 2008-01-10, 18:48   Link #4
Nicholi
King of Hosers
 
Join Date: Dec 2005
Age: 41
You don't want to encode with audio in avisynth because then you are limited to only ACM encoders (which are all crappy). You were doing it right before, though I don't know why DirectShowSource was not working. I see you have K-Lite installed which might be the problem. If the file is not loading with Haali's splitter and ffdshow (with the correct options on) I suppose it could do something weird like not load the file completely. Also make sure the CRC of the file checks out.

Otherwise you were doing it correctly. Demux the subtitles and hardsub them with TextSub. Also then you demux the audio with mkvextract and use an Ogg Vorbis decoder (something like OggDropXP is easy to use) to get the audio into a PCM Wave file, and then feed that to whatever AAC encoder you want to use (I expect you are re-encoding for some type of hardware playback? because Vorbis in MP4 will NOT work anywhere except on a PC currently). Then just use MP4Box to remux the video and audio into MP4.

Instead of DirectShowSource you could also use FFmpegSource, which is quite more reliable in my opinion. Also this will help if the video is VFR because you can get the timecodes directly from FFmpegSource, then simply mux them in with the MP4. Otherwise you have to force the stream to CFR (likely what ps3 video 9 is doing) which is nasty and not really needed because MP4 is a container which can handle VFR streams.

The way you are doing it now obviously is twice as bad because you are re-encoding twice. You only need to re-encode the video once, to hardsub it and encode to H.264 at whatever hardware required settings (again I expect you are re-encoding for PS3/xbox360 or something).
Nicholi is offline   Reply With Quote
Old 2008-01-10, 18:59   Link #5
LostSamurai
Junior Member
 
Join Date: Jan 2008
ah k well i have it all figured out.. another easy method went over my head but..
i converted the .ogg stream into .aac

then using YAMB i combined the .h264 and .aac stream into a .mp4 file
so i get both audio and video.

however combining the .srt file for subtitles into the entire thing doesn't produce the subtitles into the finished product.

so... i just altered the avisynth script a little bit (with the .ass file instead of .srt)and converted the .avs with PS3 Video 9. all is well. isn't too painful or difficult and i only have to convert once.

EDIT: and to the guy above me that is really helpful information. a few hours ago i wouldn't have had any idea what you were talking about but it does seem like a quite simple and faster method than what i'm trying to do now. thank you very much for the information.
LostSamurai is offline   Reply With Quote
Old 2008-01-11, 18:26   Link #6
Nicholi
King of Hosers
 
Join Date: Dec 2005
Age: 41
Softsubs in MP4 are not really that well supported (even on a PC), so you have to hardsub it. What you got now sounds like it is for the best, though you are still re-encoding the audio twice (once to AAC and muxed to MP4, then PS3 Video 9 will re-encode it again to AAC in the final file). You should be able to just mux the Vorbis audio into MP4 in your first step (instead of re-encoding to AAC and muxing that) and then PS3 Video 9 will re-encode it to AAC.
Nicholi 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 -5. The time now is 19:18.


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