Converting MKV with subtitles to DPG

Discussion in 'NDS - Emulation and Homebrew' started by Heere, Mar 24, 2010.

?

Do you want to know how I solved this problem?

  1. Yes

    0 vote(s)
    0.0%
  2. No

    0 vote(s)
    0.0%
Mar 24, 2010
  1. Heere
    OP

    Newcomer Heere Member

    Joined:
    Mar 24, 2010
    Messages:
    28
    Country:
    United States
    <a href='index.php?act=findpost&pid=2703170'><b><!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo--> - I've found the solution. Click here for the guide. -<!--sizec--></span><!--/sizec--></b></a>

    I have spent an entire day trying to get this to work, so any help is greatly appreciated.

    Some definitions:
    <!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo--><!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->Unacceptable<!--colorc--></span><!--/colorc--><!--sizec--></span><!--/sizec--> - audio is scratchy, video is blocky, subtitles are unreadable
    <!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo--><!--coloro:#0000FF--><span style="color:#0000FF"><!--/coloro-->Acceptable<!--colorc--></span><!--/colorc--><!--sizec--></span><!--/sizec--> - audio is fine but sounds compressed, video is watchable, subtitles are readable
    <!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo--><!--coloro:#2E8B57--><span style="color:#2E8B57"><!--/coloro-->Great<!--colorc--></span><!--/colorc--><!--sizec--></span><!--/sizec--> - audio is clear, video is clear, subtitles are how they should be

    Well, here's the deal. I am trying to convert a video to DPG format.
    It is an .mkv encoded in h264 AVC and AAC with embedded subtitles in both SSA and SRT format.
    I want the DPG video to maintain the original 16:9 aspect ratio, and have <!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo--><!--coloro:#0000FF--><span style="color:#0000FF"><!--/coloro-->Acceptable<!--colorc--></span><!--/colorc--><!--sizec--></span><!--/sizec--> audio, video and subtitles.

    The video info from MediaInfo can be found at the bottom of this post.

    I have attempted to convert this video using <b><!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->five<!--sizec--></span><!--/sizec--></b> programs, with various settings for each.
    It would take too long to describe the settings that I used for all of these programs, so here is a basic rundown.

    <b>For audio:</b> I always attempted to use the maximum quality that the GUI would allow. For example, in batchDPG, I chose 128kbps, in SUPER and the others, I chose 256kbps.

    <b>For video:</b> I always attempted to use the maximum quality that the GUI would allow without going above the DPG spec for that program. For example, in batchDPG I assumed that it was converting to DPG1/2 so I chose a video bitrate of 256-384kbps, in DPGenc, I chose a video bitrate of 1024kbps.

    <b>For subtitles:</b> I did all I could to get the subtitles to encode. DPGenc and Xilisoft do not seem to have support for subtitles. For batchDPG, I extracted the subtitles using mkvtoolnix, and fed them into the GUI. For AlltoAVI, no special setup was needed for the subtitles, but the max size "Arial_28" was too small to be readable on the DS. The output from AlltoAVI was fed through DPGenc, to produce the latest DPG4 spec.

    Here are the results from these five methods. These are all being played using an installation of Moonshell 2.1.0 :

    <!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->DPGenc<ul><li>Video: <!--coloro:#0000FF--><span style="color:#0000FF"><!--/coloro-->Acceptable<!--colorc--></span><!--/colorc--></li><li>Audio: <!--coloro:#2E8B57--><span style="color:#2E8B57"><!--/coloro-->Great<!--colorc--></span><!--/colorc--></li><li>Subtitles: <!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->Unacceptable<!--colorc--></span><!--/colorc--></li><li>Crashes DS?: <!--coloro:#00FF00--><span style="color:#00FF00"><!--/coloro-->No<!--colorc--></span><!--/colorc--></li><li>Notes: Doesn't support subtitles, DPGenc included with Moonshell 2.1.0</li></ul>
    batchDPG<ul><li>Video: <!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->Unacceptable<!--colorc--></span><!--/colorc--></li><li>Audio: <!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->Unacceptable<!--colorc--></span><!--/colorc--></li><li>Subtitles: <!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->Unacceptable<!--colorc--></span><!--/colorc--></li><li>Crashes DS?: <!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->At Start<!--colorc--></span><!--/colorc--></li><li>Notes: Video output is unplayable, batchDPG u1.6.0</li></ul>SUPER<ul><li>Video: <!--coloro:#0000FF--><span style="color:#0000FF"><!--/coloro-->(un)Acceptable<!--colorc--></span><!--/colorc--></li><li>Audio: <!--coloro:#0000FF--><span style="color:#0000FF"><!--/coloro-->(un)Acceptable<!--colorc--></span><!--/colorc--></li><li>Subtitles: <!--coloro:#0000FF--><span style="color:#0000FF"><!--/coloro-->Acceptable<!--colorc--></span><!--/colorc--></li><li>Crashes DS?: <!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->At End<!--colorc--></span><!--/colorc--></li><li>Notes: Video and audio are out of sync, but subtitles are simply included from the mkv!</li></ul>
    Xilisoft<ul><li>Video: <!--coloro:#2E8B57--><span style="color:#2E8B57"><!--/coloro-->Great<!--colorc--></span><!--/colorc--></li><li>Audio: <!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->Unacceptable<!--colorc--></span><!--/colorc--></li><li>Subtitles: <!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->Unacceptable<!--colorc--></span><!--/colorc--></li><li>Crashes DS?: <!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->At End<!--colorc--></span><!--/colorc--></li><li>Notes: Audio is scratchy, doesn't support subtitles</li></ul>AlltoAVI<ul><li>Video: <!--coloro:#0000FF--><span style="color:#0000FF"><!--/coloro-->Acceptable<!--colorc--></span><!--/colorc--></li><li>Audio: <!--coloro:#2E8B57--><span style="color:#2E8B57"><!--/coloro-->Great<!--colorc--></span><!--/colorc--></li><li>Subtitles: <!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->Unacceptable<!--colorc--></span><!--/colorc--></li><li>Crashes DS?: <!--coloro:#00FF00--><span style="color:#00FF00"><!--/coloro-->No<!--colorc--></span><!--/colorc--></li><li>Notes: Subtitles are too small to read, even on largest AlltoAVI size of "Arial_28"</li></ul><!--sizec--></span><!--/sizec-->
    Now, here is your mission, should you choose to accept it. <a href="http://www.mediafire.com/?ew1mxzzgiew" target="_blank"><b>This is a 30 second sample of the video</b></a> I am trying to encode, as split by mkvtoolnix.
    I'd like you to take this video and convert it using any method that you have that produces a video that is <!--coloro:#0000FF--><span style="color:#0000FF"><!--/coloro--><!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->Acceptable<!--sizec--></span><!--/sizec--><!--colorc--></span><!--/colorc--> or above in the four categories listed above.

    <b>Ideally, you could show me how to produce a DPG from this video using SUPER that happens to be in-sync, as SUPER is simply able to grab the subtitles from the mkv.</b>

    Yes this 30s clip is copyrighted material, but I'm sure that for this educational purpose and due to it's short duration it falls under fair-use laws. It's not even as bad as linking to a YouTube video, as the BBcode help does.

    In addition, <a href="http://www.mediafire.com/?eda3hjned3a" target="_blank">here are the "5 best" DPG videos</a> that I have been able to encode using the above programs.

    The MediaInfo:
    Warning: Spoilers inside!
     
  2. Heere
    OP

    Newcomer Heere Member

    Joined:
    Mar 24, 2010
    Messages:
    28
    Country:
    United States
    I have found a solution to my problem of the kind that only hours and hours of fiddling can produce.

    If anyone is interested please vote on the poll.

    I'll post the solution if I get 10 "Yes" votes.

    I'll check back after a few hours. Right now I need to sleep.
     
  3. jurassicplayer

    Member jurassicplayer Completionist Themer

    Joined:
    Mar 7, 2009
    Messages:
    4,280
    Location:
    Pantsuland
    Country:
    United States
    I'm at a loss of why a poll is needed xD. Also, you should probably give like half a day to a day for people to flow into this thread...
     
  4. Blackiris

    Member Blackiris GBAtemp Regular

    Joined:
    Oct 25, 2008
    Messages:
    217
    Location:
    5th Street/8th Street
    Country:
    Philippines
    I agree with JP, but I voted yes anyway. I want to watch K-On on my DS, is all [​IMG]
     
  5. twiztidsinz

    Member twiztidsinz Taiju Yamada Fan

    Joined:
    Dec 23, 2008
    Messages:
    4,981
    Country:
    United States
    Extract the Subs from MKV...
    Convert MKV to AVI...
    Resize the video to 256x192...
    Hard-sub the final video...
    Encode to DPG...


    Anyway, voted "No" because it is a very stupid and shallow idea to hold the solution to a problem YOU asked.
    How would you feel if you asked for help and someone came and posted "I'll answer this if 10 people comment thanking me"?
     
  6. jurassicplayer

    Member jurassicplayer Completionist Themer

    Joined:
    Mar 7, 2009
    Messages:
    4,280
    Location:
    Pantsuland
    Country:
    United States
    Lol, at least I know that I'm not the only one that takes such a boring route to subtitle a dpg.
     
  7. ColdPerson

    Newcomer ColdPerson Newbie

    Joined:
    Mar 15, 2010
    Messages:
    9
    Country:
    Canada
    It always worked fine for me with BatchDPG.
     
  8. ashxu

    Member ashxu GBAtemp Regular

    Joined:
    Dec 16, 2008
    Messages:
    205
    Location:
    Melbourne
    Country:
    Australia
    I use SUPER to hardsub it, convert to 30fps, then use dpenc.

    I've never had a problem. Watched 3 whole series of anime on my DS that way.
     
  9. Mario92

    Member Mario92 GBAtemp Advanced Fan

    Joined:
    Feb 20, 2010
    Messages:
    878
    Location:
    Finland
    Country:
    Finland
  10. Heere
    OP

    Newcomer Heere Member

    Joined:
    Mar 24, 2010
    Messages:
    28
    Country:
    United States
    Well, there's ten votes, but one of them is mine. I suppose it counts.

    Here's an easy way to go from MKV to DPG.

    1. Download the latest version of AlltoAVI, install it.
    2. Before running AlltoAVI, we need to change how it handles subtitle fonts. Go to AlltoAVI's font configuration directory. On 64bit versions of Windows this would be located at %ProgramFiles(x86)%\AlltoAVI\bin\mplayer, or on 32bit versions of Windows, %ProgramFiles%\AlltoAVI\bin\mplayer. Just slap those strings in a run box if you installed to the default path. Otherwise navigate to that directory.
    3. Delete everything there. That includes some ISO specified font files, and a directory called "font".
    4. Open up notepad, right click and run as administrator. Paste this in: subfont-text-scale=3.5
    4a. You just set your font size as a percentage of the frame size. Numbers can vary from 1 to 100. 3.5 works for me.
    5. Save the document as mencoder.conf to the mplayer directory indicated above.
    6. Now go to your Windows Fonts folder %windir%\fonts , and pick a nice, easy to read, font for your subtitles. Segoe UI Semibold does it for me.
    7. Copy the .ttf file into the mplayer directory and rename it subfont.ttf . At this point things should be looking like the screenshot below.
    Warning: Spoilers inside!
    Note: Once you have completed steps 1 through 7 you never need to do them again.

    8. Open AlltoAVI, right click and run as administrator. Add your mkv file, click "no" if it suggests restrictive mode. Set your settings as shown in the screenshot below. Use your media player or mkvtoolnix or mediainfo to determine which subtitle stream is the one that you want. Note that there will be an "Error" next to font folder. DO NOT CLICK THE "CHANGE FONT" button, it will overwrite the files we just created. The height and width depends on your video.
    Warning: Spoilers inside!
    9. Add the job, click convert, and wait until it is finished. On a modern quad core this takes about 10 minutes for a 24 minute episode.

    10.
    Look in the directory of your video for a directory called "Converted" to find your avi file, keep this directory open.

    11. Download the latest moonshell from the official website, install it onto your NDS memory stick. Obviously you only need to do this every time moonshell is updated.

    12.
    Look in the moonshell directory for \misctools\DPGTools\dpgenc.exe , open it. Set your options as shown below. Note: Upon further testing, an audio bitrate of 192kbps and a video bitrate of 512kbps may be required for smooth playback of scenes with a lot of action.
    Warning: Spoilers inside!
    13.
    Drag your video onto the portion of the dpgenc window as indicated, and the conversion will start automatically. I recommend dpgenc as it creates proper DPG4 files with thumbnails. This process also takes about 10 minutes on a modern quad core processor for a 24 minute episode.

    14. Note that both of these programs support batch encoding. Copy the completed DPG file to your DS and enjoy.

    FAQ

    1. Your video is ahead of your audio, your video is behind your audio, or the video is cut short:
    Make sure to choose the "force no skipping frames' option in AlltoAVI, choose the "hard code all duplicate frames" option in AlltoAVI

    2. dpgenc fails to convert:
    Choose ffmpeg from the drop down menu at the top of dpgenc's options

    3. Are there more options for the way subtitles are displayed?
    Yep, just read up on mencoder.conf files.

    4. I need a small mkv file to test my subtitle settings.
    Well, you're in luck. The subtitle stream that you want to test with is "1 eng" not 0.

    5. Does this method require me to have a subtitle file in .srt or SSA?
    No, that's the point of using AlltoAVI. It does the subtitle work for you, but you have to manually change the font and size.

    6. How did you figure this out?
    I got very frustrated with the way AlltoAVI was handling fonts. So I tried some manual mencoder encodes. Turns out it was easy enough to merge my knowledge of mencoder at that point to be used with AlltoAVI. I would contact the developer of AlltoAVI with this information, but he hasn't updated the project in three years so he probably doesn't care.
     
  11. jurassicplayer

    Member jurassicplayer Completionist Themer

    Joined:
    Mar 7, 2009
    Messages:
    4,280
    Location:
    Pantsuland
    Country:
    United States
    Well, it is detailed...although slightly overbearing with the "have it like this" structure.
    I wouldn't say 14 steps is all that simple (a simple drag and drop would be nice. Maybe use a .bat file and a command line converter...LAME? I can't even remember what LAME supports xD), but it could have been worse I suppose.
    At the rock bottom, at least there is a picture of Mikuru. All things are good with a picture of Mikuru xD...well and you are using a Clannad episode for your example, which also rocks.

    -edit-
    Oh, AlltoAvi IS a commandline converter xD. Then you should just make a .bat file and tell us to have the stuff we need and then it becomes super simple =D.
     
  12. Heere
    OP

    Newcomer Heere Member

    Joined:
    Mar 24, 2010
    Messages:
    28
    Country:
    United States
    Well, I hope you attempted to follow the guide at least once.

    If you did, you would have noticed that steps 1-7 only need to be completed once, forever (as long as you don't hit the "change font" button as mentioned).
    If you take a look at the rest of the steps, only steps 8, 9, 10, 12, and 13 need to be completed each time you convert a video file.
    In addition, I wanted to include enough detail in this guide so that I wouldn't get a huge list of silly responses. Also note that some steps, like step 10, are hardly steps at all.

    A batch file is entirely unnecessary for this method. After you have followed the guide once, maybe twice, it all comes down to clicking the "convert" button in two very simple GUI programs that both support batch encoding themselves.

    Have fun!
     
  13. ColdPerson

    Newcomer ColdPerson Newbie

    Joined:
    Mar 15, 2010
    Messages:
    9
    Country:
    Canada
    >Implying that 32-bit is old
     
  14. Heere
    OP

    Newcomer Heere Member

    Joined:
    Mar 24, 2010
    Messages:
    28
    Country:
    United States
    There are 32 bit versions of Windows Vista, Windows 7 and Server 2008.

    I only implied that Windows versions older than 2006 are old. I'd say four years is enough time for you to switch.

    Edit:
    Oh I see what you mean. Sure, I'll change the wording.
     
  15. ashxu

    Member ashxu GBAtemp Regular

    Joined:
    Dec 16, 2008
    Messages:
    205
    Location:
    Melbourne
    Country:
    Australia
    Your way to too long. Just use SUPER to convert it with the right settings, then whack it into dpgenc.
     
  16. Heere
    OP

    Newcomer Heere Member

    Joined:
    Mar 24, 2010
    Messages:
    28
    Country:
    United States
    Upload a DPG you've encoded using SUPER that was originally an mkv, has the subtitles intact in a nice font, is the correct aspect ratio, and doesnt crash the DS when it ends.
     
  17. jurassicplayer

    Member jurassicplayer Completionist Themer

    Joined:
    Mar 7, 2009
    Messages:
    4,280
    Location:
    Pantsuland
    Country:
    United States
    Most likely, he could be just converting it into a nice file for dpgenc, and since Super is amazing as a converter (not directly to .dpg, but to other formats), he probably has a fairly high quality video in a nice format that he can "whack into dpgenc"...I don't know if he has any issues with subtitles (I don't remember if Super supports that), but aspect ratio is jack easy and the .dpg file would only crash if he converted it straight to .dpg....and he clearly states that he "whacks it into dpgenc" which totally circumvents the .dpg0 (was it zero? or maybe one? can't remember) freezing issue...

    In any case, I still think having just a .bat file is wonderful enough, just set it up to check everything and all the rest of the stuff once, then just make it go straight to dpgenc, then all you ever have to do for the rest of eternity is drag and drop whatever video file you want onto the .bat file and presto, within strange ranges of time (depending on what you convert) you have a .dpg ready for playing. Only part that isn't great about this idea is that there has to be someone willing to MAKE the .bat file xD.
     
  18. Heere
    OP

    Newcomer Heere Member

    Joined:
    Mar 24, 2010
    Messages:
    28
    Country:
    United States
    Converting with AlltoAVI then dpgenc is the same as converting with SUPER then dpgenc.

    At least with AlltoAVI the aspect ratio is guaranteed (SUPER will stretch the video even if you tell it not to), and the font can be changed.

    Again, it is impractical to create a batch file for these two programs (AlltoAvi and dpgenc), as they both support batch encoding, and have very simple GUIs that most people would rather use than editing text switches in a batch file.

    If you are really that lazy that you want a batch file, then follow the guide once for a batch of videos and notice how simple it is. I have a feeling you haven't even read the whole guide or you would realize how hold-handy it is and how easy it is to use.
     
  19. jurassicplayer

    Member jurassicplayer Completionist Themer

    Joined:
    Mar 7, 2009
    Messages:
    4,280
    Location:
    Pantsuland
    Country:
    United States
    xD Maybe I'm just a lazy bastard...but I think people would prefer just having something where all they need to do is have a movie/video they want to convert, and drop it into one file that almost nobody cares what is inside (if I ever make a .bat file like that, I'm never looking inside it ever again), just that a couple minutes later, there is a nice working .dpg file on their desktop when they come back.

    Oh and after reading the beginning of what you used to test the quality of the .dpg files...I think you shouldn't have tested them that way. It probably would have been better to convert the same video with the same settings for all of the programs. At least then if there is a noticeable difference in quality, you can attribute it to the converter rather than just setting everything at the highest it can possibly go and compare the final results.
    In the former case, it can be imagined as a bunch of race cars with the same build, but a different engine.
    In the latter case, it can be imagined as a bunch of random cars in a race, and in this case, it is possible that it isn't the car with the best engine that wins, but rather the car with a mediocre engine that still has tires. (If this makes sense that is good...particularly the second sentence is a little bit harder to understand, but I can't think of another way to describe it atm)

    -edit-
    Unfortunately I do spend the time attempting to read stuff like this. Surprisingly enough, I somehow manage to comprehend a lot in a short amount of time (although at times I wish it were quicker...my MS2 previewer would be done if I had the researching ability and motivation xD)
     
  20. Heere
    OP

    Newcomer Heere Member

    Joined:
    Mar 24, 2010
    Messages:
    28
    Country:
    United States
    You are correct in saying that I shouldn't have varied more than one thing in the original tests (that being the encoding suite), but in essence I was not changing anything by changing the settings. All of them were outputting "the best file that they could". Also recall that I was using the same input file for all methods.

    It doesn't really matter what bitrates I was using, all of the original tests produced files that either:

    A. Crashed the DS

    or

    B. Did not support subtitles at all

    This guide is actually using one of the methods from the original tests, "AlltoAVI", I simply found a way to change the appearance of the subtitles in order to bring the final DPG to an 'Acceptable' level for video 'Great' level for audio 'Great' level for subtitles, and no DS crash.
     

Share This Page