{"id":202,"date":"2011-02-11T17:22:58","date_gmt":"2011-02-12T00:22:58","guid":{"rendered":"http:\/\/www.analogrithems.com\/rant\/?p=202"},"modified":"2011-02-11T17:24:14","modified_gmt":"2011-02-12T00:24:14","slug":"convert-avimkvmp4-to-dvd-in-osx-or-someother-nix-derivative","status":"publish","type":"post","link":"https:\/\/www.analogrithems.com\/rant\/convert-avimkvmp4-to-dvd-in-osx-or-someother-nix-derivative\/","title":{"rendered":"Convert avi\/mkv\/mp4 to dvd in OSX or Someother *nix derivative"},"content":{"rendered":"<p>I often need to convert avi, mkv, mp4 or some other video format to generic DVD.\u00c2\u00a0 Using a Mac, I&#8217;ve found that this processes is a pain in the ass.\u00c2\u00a0 It surprises me that there are very few tools for pulling this together.\u00c2\u00a0 I spent a few days searching and see that there was a few tools, but they were either dead projects, or not stable.\u00c2\u00a0 Don&#8217;t get me wrong, FFMpegX is pretty good at converting video formats, but trying to use it to actually make a dvd with subtitles just doesn&#8217;t work for me.\u00c2\u00a0 I did notice that it was based of the opensource ffmpeg, dvdauthor and cdrtools projects, so I decided to use my Darwin Ports system to install the packages (With all prerequisites)\u00c2\u00a0 and use the command line tools to do all the conversion.<\/p>\n<p>sudo port install ffmpeg<\/p>\n<p>sudo port install dvdauthor<\/p>\n<p>sudo port install cdrtools<\/p>\n<p>I had no clue how easy the command line tools would be to use and decided to document for my own use later.\u00c2\u00a0 Most of my info came from <a href=\"http:\/\/atomized.org\/2005\/03\/converting-divxxvid-avi-to-dvd-with-ffmpeg\/\">http:\/\/atomized.org\/2005\/03\/converting-divxxvid-avi-to-dvd-with-ffmpeg\/<\/a><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Step 1)\u00c2\u00a0 Convert Source file to DVD video format<\/strong><\/span><\/p>\n<p>The first thing you need to do is convert the video file to a mpeg2 file with the proper video dimensions 720&#215;480.\u00c2\u00a0 Luckily the FFMpeg package has a predefined template for it &#8216;-target ntsc-dvd, or -target pal-dvd for europe&#8217;.\u00c2\u00a0 Since I have a widescreen plasma screen, I use the 16:9 aspect ratio, if you have a more square tv, or if you just want your file more square use the &#8216;-aspect 4:3&#8217;\u00c2\u00a0 The ffmpeg <a href=\"http:\/\/www.ffmpeg.org\/faq.html\">faq<\/a> has some great info on additional options like converting videos to play on game consoles or smart phones or even to just a different format.\u00c2\u00a0 FFMPEG can be downloaded from <a href=\"http:\/\/www.ffmpeg.org\">http:\/\/www.ffmpeg.org<\/a> for non-osx systems<\/p>\n<p>ffmpeg -i MyMovie.avi -target ntsc-dvd -aspect 16:9 -sameq MyMovie.mpg<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Step 2) Add Subtitles (If Needed)<\/span><\/strong><\/p>\n<p>The easiest way to add subtitles to your newly created mpeg2 file is with DVDAuthor&#8217;s spumux tool.\u00c2\u00a0 This tool is a bit confusing to use, so I&#8217;ll try to make this as simple as possible.\u00c2\u00a0 First you need to make a xml config file for each subtitle you want to add.\u00c2\u00a0 Here is the one I make, and tend to use over and over by copying the file and changing the subfile name inside. Get the DVDauthor tools here <a href=\"http:\/\/dvdauthor.sourceforge.net\">http:\/\/dvdauthor.sourceforge.net<\/a><\/p>\n<p>&lt;subpictures&gt;<br \/>\n&lt;stream&gt;<br \/>\n&lt;textsub filename=&#8221;ongbak.3.english.srt&#8221; characterset=&#8221;ISO8859-1&#8243;<br \/>\nfontsize=&#8221;28.0&#8243; font=&#8221;Geneva.ttf&#8221;<br \/>\nhorizontal-alignment=&#8221;center&#8221;<br \/>\nvertical-alignment=&#8221;bottom&#8221; left-margin=&#8221;40&#8243;<br \/>\nright-margin=&#8221;40&#8243;<br \/>\ntop-margin=&#8221;20&#8243; bottom-margin=&#8221;30&#8243;<br \/>\nsubtitle-fps=&#8221;25&#8243;<br \/>\nmovie-fps=&#8221;25&#8243; movie-width=&#8221;720&#8243; movie-height=&#8221;480&#8243;<br \/>\nforce=&#8221;yes&#8221;<br \/>\n\/&gt;<br \/>\n&lt;\/stream&gt;<br \/>\n&lt;\/subpictures&gt;<\/p>\n<p>Here is a simple breakdown of what is going on in this config. Better definition found here <a href=\"http:\/\/dvdauthor.sourceforge.net\/doc\/spumux.html\">http:\/\/dvdauthor.sourceforge.net\/doc\/spumux.html<\/a><\/p>\n<ul>\n<li><strong>filename<\/strong> &#8211; This is the subtitle file you will be attaching.<\/li>\n<li><strong>characterset<\/strong> &#8211; This is the characterset for your subtitle text to use in the film.\u00c2\u00a0 For english you can use ISO8859-1, for other languages reference http:\/\/en.wikipedia.org\/wiki\/Character_encoding<\/li>\n<li><strong>fontsize<\/strong> &#8211; This is the size of the font to display in the movie<\/li>\n<li><strong>font<\/strong> &#8211; Which font to show as.\u00c2\u00a0 The fonts used by spumux are locate in ~\/.spumux\/<\/li>\n<li><strong>horizontal-alignment<\/strong> &#8211; Where to place the subtitles in the film, {left, right, center}<\/li>\n<li><strong>vertical-alignment <\/strong>&#8211; Where to place the subtitles on the film {top, center, bottom}<\/li>\n<li><strong>right-margin<\/strong> &#8211; Don&#8217;t really understand these<\/li>\n<li><strong>left-margin<\/strong> &#8211; Don&#8217;t really understand these<\/li>\n<li><strong>top-margin<\/strong> &#8211; Don&#8217;t really understand these<\/li>\n<li><strong>bottom-margin<\/strong> &#8211; Don&#8217;t really understand these<\/li>\n<li><strong>subtitle-fps<\/strong> &#8211; Just set this to 25, for DVD<\/li>\n<li><strong>movie-fps<\/strong> &#8211; Just set this to 25, for DVD<\/li>\n<li><strong>movie-width<\/strong> &#8211; for DVD set to 720 for wide or 640 4:3<\/li>\n<li><strong>movie-height<\/strong> &#8211; for dvd set to 480<\/li>\n<li><strong>force<\/strong> &#8211; turns the subtitle without being selected<\/li>\n<\/ul>\n<p>spumux -s 0 -P MyMovie.xml &lt; MyMovie.mpg &gt; MyMovie.sub.eng.mpg<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Step 3) Convert mpg to Video_TS format, this is called DVD authoring<\/span><\/strong><\/p>\n<p>Now that we have our file encoded to the mpeg2 (AKA DVD) format and perhaps even the subtitles, it&#8217;s time to get the mpeg file turned into the more recognizable video_ts structure.\u00c2\u00a0\u00c2\u00a0 You can get the full lowdown on all the dvdauthor arguments from <a href=\"http:\/\/dvdauthor.sourceforge.net\/doc\/r1741.html\">http:\/\/dvdauthor.sourceforge.net\/doc\/r1741.html<\/a><\/p>\n<p>dvdauthor &#8211;title -f MyMovie.sub.eng.mpg -o MyMovie<\/p>\n<p>the -o MyMovie means create a output directory with the VIDEO_TS subdirectory &amp; files inside<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Step 4) Create the DVD menu system<\/strong><\/span><\/p>\n<p>Now that the mpeg file is in the video_ts directory structure (and is broken into vob files). You need to make the dvd menu.\u00c2\u00a0 Personally I don&#8217;t care for advanced menus.\u00c2\u00a0 I just want my movies to start, so I use the following command to just make an empty menu that just auto starts the movie.<\/p>\n<p>dvdauthor -T -o MyMovie<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Step 5) Create ISO image from finished VIDEO_TS directory<\/span><\/strong><\/p>\n<p>Now that we have our functioning dvd video, lets convert it to an ISO that we can burn.\u00c2\u00a0 I do this with the mkisofs command from the cdrtools package.\u00c2\u00a0 It&#8217;s pretty simple, just use the following.\u00c2\u00a0 You can get cdrtools from\u00c2\u00a0 <a href=\"http:\/\/cdrecord.berlios.de\/\">http:\/\/cdrecord.berlios.de\/<\/a><\/p>\n<p>mkisofs -dvd-video -o MyMovie.iso MyMovie\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I often need to convert avi, mkv, mp4 or some other video format to generic DVD.\u00c2\u00a0 Using a Mac, I&#8217;ve found that this processes is a pain in the ass.\u00c2\u00a0 It surprises me that there are very few tools for pulling this together.\u00c2\u00a0 I spent a few days searching and see that there was a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,28,11,29],"tags":[],"class_list":["post-202","post","type-post","status-publish","format-standard","hentry","category-linux","category-osx","category-unix","category-video"],"_links":{"self":[{"href":"https:\/\/www.analogrithems.com\/rant\/wp-json\/wp\/v2\/posts\/202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.analogrithems.com\/rant\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.analogrithems.com\/rant\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.analogrithems.com\/rant\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.analogrithems.com\/rant\/wp-json\/wp\/v2\/comments?post=202"}],"version-history":[{"count":4,"href":"https:\/\/www.analogrithems.com\/rant\/wp-json\/wp\/v2\/posts\/202\/revisions"}],"predecessor-version":[{"id":206,"href":"https:\/\/www.analogrithems.com\/rant\/wp-json\/wp\/v2\/posts\/202\/revisions\/206"}],"wp:attachment":[{"href":"https:\/\/www.analogrithems.com\/rant\/wp-json\/wp\/v2\/media?parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.analogrithems.com\/rant\/wp-json\/wp\/v2\/categories?post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.analogrithems.com\/rant\/wp-json\/wp\/v2\/tags?post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}