Page 1 of 2

MKV to MPG2 NTSC DVD Compliant files - How?

Posted: Wed Nov 14, 2007 5:16 pm
by pparker
To the experts... I have after many attempts been unable to output an NTSC DVD Compliant mpg file. I have used Extensions, have changed values in Settings and done everything I can find to do after about 12 attempts. I have searched and read all the Forum posts and Tips, as well as googled for answers. I have around 30 hours into this now, so I feel justified in asking for help.

My last attempt was directly after a fresh install of 3945, the latest version.

The video, audio and subtitles of the output file are of decent quality. The file format is non-compliant. It will play in VLC, but will not play in Media Player Classic (hangs). When I import to DVD Architect, the aspect ratio is incorrect until I force the settings in the project, however, it does display it properly
afterwards.

Please look at the information provided below and tell me what needs to be changed, or provide a list of settings in MediaCoder that will result in DVD Compliant files. I really want to use MediaCoder because it is the only app that can hardcode subs directly from MKV to MPG, and if the files were compliant, it would save my having to encode from MKV to AVI and then re-encode the subs before creating the mpgs, adding 1.5 hours to burning every episode.

I have been using DVDFlick for about 3 months and have burned about 300 anime episodes, and every output file was DVD Compliant. In fact, I never even knew the term DVD Compliant until I tried MediaCoder. DVDFlick of course front ends FFMPEG as does MediaCoder, so the encoder is not the issue. It is just a matter of FFMPEG switches (I can provide the DVDFlick log entry with command line if desired, that produces compliant files).

My system is WinXP SP2, and all other information is listed below.


INFO PROVIDED
===========
Settings
Tabs (Right, Left)
Expert Tabs (ffmpeg command lines for video and audio)
Input File Details
Output File Details
Logger (since app initiation)
Note: Bug on Frame Rate in New Version


Settings > Video Encoders > FFMPEG
------------------------------------------
Target format dvd
Extra Options String -r 29.976 (Frame Rate setting in tabs no longer works in current version*)


Left Tabs
-----------
Summary
-----------
Container: MPEG2
Video: MPEG2
Bitrate: 3200 Kbps
Resolution: Original
Audio: FFMPEG Audio Codecs
Audio: 192 Kbps
Estimated Size: 608 MB

Audio
-------
Source: (selected) Auto Select
Encoder: FFPMEG
Resample: Original
Channel: Stereo
Gain: 0 dB
Audio ID: 0
(selected) Enable Audio
(unselected) Copy Audio
(unselected) Normalize

Video
------
Mode: Bitrate Based (selected) Enable Video
3200 Kbps
Format: MPEG2
Container: MPEG2
Source MEncoder
Backend: FFMPEG
(unselected) all other options

Muxer
-------
(selected) Auto Select
(MP4Box)

Picture
--------
Resize: 720x480 (unselected) Global
Crop: disabled
Frame Rate (unselected) (setting no longer works in new version, set manually in Settings*)
Aspect Ratio: 16:9
(unselected) all other options

Subtitles
----------
Language: en
ID: 0
Font: Lexia (TrueType)
Scale: Movie Height


Right Tabs
------------
FFMPEG
---------
Audio Format: AC3
Bitrate: 192 Kbps


Expert Tabs > Audio Options
---------------------------------
".\codecs\ffmpeg.exe" -i - -acodec ac3 -ab 192000 "$(DestFile)"

Expert Tabs > Video Options
---------------------------------
[1] ".\codecs\ffmpeg.exe" -y -f s16le -ar 48000 -ac 2 -i pipe:0 -f yuv4mpegpipe -i - -f dvd -vcodec mpeg2video -me full -me_range 16 -mbd 1 -qmin 2 -qmax 31 -b $(VideoBitrate*1K) -s 720x480 -aspect 16:9 -r 29.976 -refs 5 -ac 2 -ab 192000 -acodec ac3 "$(DestFile)"


INPUT FILE Details (MediaCoder > Properties)
-----------------------------------------------------
General #0
Complete name :

G:\VIDEO_TEMP\[AnY-Nanashi]_Ichigo_Mashimaro_OVA_-_01_[H264_AAC_Softsubs][F5087A7B].mkv
Format : Matroska
File size : 168 MiB
PlayTime : 25mn 4s
Bit rate : 936 Kbps
Encoded date : UTC 2007-04-08 21:37:45
Writing application : mkvmerge v2.0.2 ('You're My Flame') built on Feb 21 2007 23:40:55
Writing library : libebml v0.7.7 + libmatroska v0.8.1
Cover : Main Font / Main Font

Video #0
Codec : MPEG-4 AVC
Codec/Info : MPEG4 ISO advanced profile
PlayTime : 25mn 2s
Width : 768 pixels
Height : 432 pixels
Aspect ratio : 16/9
Frame rate : 23.976 fps
Title : Main Video
Language : Japanese

Audio #0
Codec : A_AAC
Channel(s) : 2 channels
Sampling rate : 48 KHz
Title : Main Audio
Language : Japanese

Text #0
Codec : ***
Codec/Info : Advanced Sub Station Alpha
Title : Subtitles
Language : English

Chapters #0
Language : Japanese
1 : 00:00:00.000 Opening Start
2 : 00:01:40.058 Part A
3 : 00:12:24.035 Eyecatch
4 : 00:12:35.004 Part B
5 : 00:23:03.966 Ending
6 : 00:24:37.142 Preview


OUTPUT FILE Details (MediaInfo)
-------------------------------------
General #0
Complete name : G:\VIDEO_TEMP\TEMP

mediacoder\[AnY-Nanashi]_Ichigo_Mashimaro_OVA_-_01_[H264_AAC_Softsubs][F5087A7B].mpg
Format : MPEG-2 Program
Format/Family : MPEG-2
File size : 422 MiB
PlayTime : 24mn 59s
Bit rate : 2361 Kbps

Video #0
Codec : MPEG-2 Video
Codec profile : Main@Main
Codec settings/Matri : Standard
PlayTime : 24mn 59s
Bit rate : 2123 Kbps
Bit rate mode : VBR
Width : 720 pixels
Height : 480 pixels
Display Aspect ratio : 16/9
Frame rate : 29.970 fps
Standard : NTSC
Chroma : 4:2:0
Interlacement : Progressive
Bits/(Pixel*Frame) : 0.205

Audio #0
Codec : AC3
PlayTime : 24mn 59s
Bit rate : 192 Kbps
Bit rate mode : CBR
Channel(s) : 2 channels
Channel positions : L R
Sampling rate : 48 KHz

Menu #0
Codec : DVD-Video


LOGGER OUTPUT
-------------------
[10-13 22:57:26] [HTTPd] Attempting to start built-in HTTPd on port 19819
[10-13 22:57:26] [HTTPd] Built-in HTTPd started on port 19819
[10-13 22:57:26] Scanning plugins
[10-13 22:57:26] Initialized
[10-13 23:00:23] [httpd] 'videoenc.ffmpeg.format' set to 'dvd'
[10-13 23:09:18] [httpd] 'videofilter.frame.fps' set to '29.97'
[10-13 23:14:08] [httpd] 'videoenc.ffmpeg.options' set to '-r 29.976'
[10-13 23:15:18] Start transcoding job for
G:\VIDEO_TEMP\[AnY-Nanashi]_Ichigo_Mashimaro_OVA_-_01_[H264_AAC_Softsubs][F5087A7B].mkv
[10-14 00:15:36] Encoder terminated unexpectedly.
[10-14 00:15:36] FFMPEG unloaded
[10-14 00:15:36] Finished transcoding job for
G:\VIDEO_TEMP\[AnY-Nanashi]_Ichigo_Mashimaro_OVA_-_01_[H264_AAC_Softsubs][F5087A7B].mkv


*Note: Bug on Framerate in New Version
-----------------------------------------------
In the previous version I was using, 3905, setting the frame rate in the Picture tab would update the Summary tab to the same value. The value was 29.97. In the new version, selecting a Frame Rate in Picture does not update the Summary. Also, the Frame Rate is given as 29.970, which is a
non-standard frame rate.

Apparently, the framerate does get entered on the command line, but it is the non-standard value of 29.970, requiring that the frame rate be manually overriden in Settings. It is unknown to me which value ffmpeg uses, although if the Target Format is set to "dvd", it should choose the standard rate in any case.

I didn't document it, but I believe if you look at the data, you'll see that the Resolution also no longer updates in the Summary tab in the new version.

Posted: Fri Nov 16, 2007 3:56 pm
by pparker
Perhaps I offended someone? Or gave you too much data? Or is it not understood what I mean? When I load MPGs into a DVD authoring program (DVD Architect, DVDAuthor), it verifies whether or not the files are fully DVD compliant and wants to re-encode them if they aren't. ALL the apps I have used to convert MKVs produce MPGs that are non-compliant in video, audio or both, except one other app, but it doesn't handle subtitles.

MediaCoder is the best, in fact only, app I have found that will do what I need, which is to convert an MKV to MPG at sufficient quality and in one step while hard coding the subtitles in the original style of the author. Period.

All I am asking is if anyone knows what settings to use in MediaCoder (and how to set them) to have the MPG come out DVD compliant. Has anyone ever cared about that and figured it out?

I can still create VOBs without re-encoding in DVDAuthor (but not in DVD Architect), and they do play in my DVD player. I am just concerned about someday, long after the AVIs are no longer available, if I replace my player or whatever, will these VOB files still play.

I would appreciate any answer here, even it it's to say it can't be done in MediaCoder or it doesn't matter. I am not an expert, so I could be somewhat off about this. But I have spent four months trying to resolve this issue with MKVs (the format from hell, as I call it), and I have literally over 50 app install folders to prove it.

This would be the very last issue, so I would really appreciate some feedback.

Posted: Sat Nov 17, 2007 5:35 am
by SirAuron
You didn't offend anyone, however it can take some time for a post o be answered.

Did you try the MPEG Maker or Video Disc Player extensions? They should provide you with what you need.

In fact, I think mkv is wonderful. Support for every filetype I can imagine, styled softcoded subs, several audio streams... almost perfect:)

Posted: Sat Nov 17, 2007 7:01 am
by pparker
Sorry, I guess after 5 months of trying to get from MKV faithfully to MPG/VOB, and being one step away, I got too impatient ;>

Used MPEG Maker, and even tried creating an edited version that used ffmpeg command switches from DVDFlick (e.g., "-strict 2"), and then also found "Target format" in Settings>Video Encoders>FFMPEG and set that to "dvd". Didn't change any other settings.

With using extension MPEG Maker, several settings were duplicated on the command line, though I doubt this matters to ffmpeg. With that, or with Target format "dvd", both results were non-compatible.

I realize no one may have cared enough about this to figure it out, and that's okay. But since it is possible for ffmpeg to produce compliant files, I just would like to know if possible what settings/switches would do that in MediaCoder.

<rant>
I won't rant much more about MKV, other than to say it's a by-geeks-for-geeks format that doesn't have hardware support beyond PC and is hell to convert with subtitles to a format that does. Non-geeks need not apply... And I get DVD quality on my TV from MKVs converted to MPGs (even via AVI). And also on grandma's TV, on managed image corporate laptops, on my non-geek friend's PS2, etc, etc, ...insert innumerable exception cases to PC-based playing. So why as a "consumer" do I need MKV?
</rant>

Posted: Sat Nov 17, 2007 11:45 pm
by SirAuron
Right now MKV is sort of next generation. As with all innovations which are notsupported by big players (like microsoft) it will take some time until it's accepted. Think of divx, it took ages until the first dvd players could play it and today it's the most standard.


Concerning your problem: I never had problems like yours (just used the MPEG Maker and burned as Video DVD using nero (without reencode needed). Maybe you can find something about this in the forum. I am quite sure several people have posted the settings they used for a dvd compliant mpeg.

Posted: Sun Nov 18, 2007 2:20 am
by pparker
Thanks. I can author and burn them with DVD Author, just not DVD Architect which has a really nifty interface and fast. I may try some other authoring apps to see if they choke.

Posted: Thu Dec 27, 2007 1:27 pm
by buxy95
pparker wrote:All I am asking is if anyone knows what settings to use in MediaCoder (and how to set them) to have the MPG come out DVD compliant. Has anyone ever cared about that and figured it out?
well, it's 3:19 AM here, but i figured out something related to your problem. i have downloaded and analyzed the DVD Flick and its log file. and then i started to minimize the parameters. the difference is that i have a DV AVI file with PCM sound. these settings should work with DVD Architect 4.0, i was playing with the command line ffmpeg.exe:

ffmpeg -i inputfile.avi -aspect 4:3 -target dvd outputfile.mpg

well, i'm not pleased with the video quality, it's quite blocky, but hey, DVDA finally accepts the file! :)

inform us about your progress please!

cheers,
BuXY

Posted: Thu Dec 27, 2007 4:14 pm
by pparker
buxy95 wrote:
pparker wrote:All I am asking is if anyone knows what settings to use in MediaCoder (and how to set them) to have the MPG come out DVD compliant. Has anyone ever cared about that and figured it out?
well, it's 3:19 AM here, but i figured out something related to your problem. i have downloaded and analyzed the DVD Flick and its log file. and then i started to minimize the parameters. the difference is that i have a DV AVI file with PCM sound. these settings should work with DVD Architect 4.0, i was playing with the command line ffmpeg.exe:

ffmpeg -i inputfile.avi -aspect 4:3 -target dvd outputfile.mpg

well, i'm not pleased with the video quality, it's quite blocky, but hey, DVDA finally accepts the file! :)

inform us about your progress please!

cheers,
BuXY
Wow, this feels like a long time ago! Too bad the quality suffered so much in the solution.

I gave up the fight and went back to my standard routine that works perfectly even though it takes 3X as long. DVDA is too good to give up, and no single app would convert the MKV's to MPGs correctly (though MediaCoder came closest). The irony is, the apps I use are all front ends to either mencoder or ffmpeg anyway, which is why it didn't make sense.

Thanks for the effort on this. One day when I have some time I'll try again with your solution and see if I can maintain quality as well. For now, my backlog of MKV's is pretty small, plus I avoid them whenever any alternative at all is available. And life just isn't giving me enough time to play these days ;>

Posted: Fri Dec 28, 2007 2:13 am
by buxy95
pparker wrote:Wow, this feels like a long time ago! Too bad the quality suffered so much in the solution.
unfortunately mediacoder uses mencoder for mpeg2 encoding, and i couldn't get it to work with ffmpeg.

if i choose ffmpeg for backend, like this topic says: viewtopic.php?t=64 then in Expert mode, the Video options get blank. starting the conversion results in an instant program crash (losing all your settings). :(

i didn't try with MKV, only with AVI, but there is a more complex ffmpeg command line statement that makes 8000 kbit mpeg2, looks a bit better than Vegas' MainConcept 6Mbit. Edit: No it doesn't. :( it also creates AC3 audio that is suitable for DVDA. it looks like this:

ffmpeg -i inputfile.avi -preme 1 -precmp 2 -subcmp 8 -mbcmp 8 -cmp 1 -mbd 1 -sws_flags lanczos -g 15 -vcodec mpeg2video -bufsize 1835008 -packetsize 2048 -muxrate 10080000 -aspect 4:3 -minrate 8000k -maxrate 8000k -b 8000k -sc_threshold -9000 -bf 1 -fflags genpts -strict 2 -f dvd -sn -ab 384000 -acodec ac3 outputfile.mpg

it's slower, though, and still 1-pass.

cheers,
buxy

Posted: Fri Dec 28, 2007 7:41 am
by pparker
buxy95 wrote:unfortunately mediacoder uses mencoder for mpeg2 encoding, and i couldn't get it to work with ffmpeg.
In MediaCoder, ffmpeg works for me, but I get best results with mencoder for video and ffmpeg for audio. My current first step app uses mencoder as well (AllToAVI) for MKV to AVI (video/audio). VirtualDubMod is second stage, for hardcoding subs into the AVI (using AVI Recomp). ffmpeg is used in my final stage AVI to MPG (DVDF).
buxy95 wrote:...starting the conversion results in an instant program crash (losing all your settings). :(
Are you saving settings as a Preset (File/Save As Preset)? I did that for each test iteration, otherwise I would have gone crazy keeping up with settings changes.
buxy95 wrote:i didn't try with MKV, only with AVI,
OH! This whole mess is only because of MKV with soft subtitles. I've probably converted over 1,000 AVI's to MPG with DVDF, and get excellent high quality DVDA-compliant MPG every time. So for MKV, I first get to AVI, then go AVI to MPG with DVDF. Actually, I can even go directly MKV to MPG with DVDF if the subtitles are hardcoded, which is very rare since a primary feature of MKV is soft subs.

MediaCoder does it all one-step MKV+subs to MPG, except for that one little last problem of not producing MPG files that I can use in DVDA. I even get DVD compliant audio with MediaCoder. It's just the video that isn't compliant.

Actually, my real problem is a couple of anime fansubbers who are crusading for MKV format and have stopped releasing in AVI. But that's a rant for another forum. :?