<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Zuzur&#039;s corner &#187; mpeg2</title>
	<atom:link href="http://arzur.net/tag/mpeg2/feed/" rel="self" type="application/rss+xml" />
	<link>http://arzur.net</link>
	<description>technology, the web, programming and a bit of this and that ...</description>
	<lastBuildDate>Thu, 29 Dec 2011 09:24:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Burning MPEG2-TS to DVD &#8211; E03 &#8211; adding the subtitles</title>
		<link>http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e03-adding-the-subtitles/</link>
		<comments>http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e03-adding-the-subtitles/#comments</comments>
		<pubDate>Sun, 16 May 2010 10:30:32 +0000</pubDate>
		<dc:creator>erwan</dc:creator>
				<category><![CDATA[video]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[mpeg2]]></category>

		<guid isPermaLink="false">http://arzur.net/?p=62</guid>
		<description><![CDATA[DVD subtitles aren't text, hardware players don't support rendering text into fonts, so you have to insert images that will be displayed by the player at the right time. When demuxing our TS in the first article, we have extracted the subtitles in subrip format. We now need a tool that will create another MPEG2 [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Farzur.net%2F2010%2F05%2F16%2Fburning-mpeg2-ts-to-dvd-e03-adding-the-subtitles%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Farzur.net%2F2010%2F05%2F16%2Fburning-mpeg2-ts-to-dvd-e03-adding-the-subtitles%2F&amp;source=zuzur&amp;style=compact&amp;service=bit.ly&amp;service_api=R_0f41ee6dc559533f38d25e8df96d20fd&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>DVD subtitles aren't text, hardware players don't support rendering text into fonts, so you have to insert images that will be displayed by the player at the right time.</p>
<p>When demuxing our TS in <a href="http://arzur.net/2010/05/07/burning-mpeg2-ts-to-dvd-e01-cutpoints-and-demux-with-projectx/">the first article</a>, we have extracted the subtitles in subrip format. We now need a tool that will create another MPEG2 track that contains images of the subtitles, rendered with the right font.</p>
<p><code>spumux</code>, part of the <code>dvdauthor</code> suite does this job fairly well. Again, use your package manager to install <code>dvdauthor</code> and you should be able to use it.</p>
<h2>XML subtitles descriptor</h2>
<p><code>spumux</code> uses an XML descriptor file that helps it render the subtitles. You specify the location of the subrip file, its charset, the font that will be used for rendering the text, and various other parameters for the location of the subtitles.</p>
<p>Here is the content of the file named <code>stream-subs.xml</code> we are going to use for this project.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;subpictures<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;stream<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
             <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textsub</span> <span style="color: #000066;">filename</span>=<span style="color: #ff0000;">&quot;stream[889].srt&quot;</span> <span style="color: #000066;">characterset</span>=<span style="color: #ff0000;">&quot;ISO8859-1&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">fontsize</span>=<span style="color: #ff0000;">&quot;28.0&quot;</span> <span style="color: #000066;">font</span>=<span style="color: #ff0000;">&quot;arial.ttf&quot;</span> <span style="color: #000066;">horizontal-alignment</span>=<span style="color: #ff0000;">&quot;center&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">vertical-alignment</span>=<span style="color: #ff0000;">&quot;bottom&quot;</span> <span style="color: #000066;">left-margin</span>=<span style="color: #ff0000;">&quot;60&quot;</span> <span style="color: #000066;">right-margin</span>=<span style="color: #ff0000;">&quot;60&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">top-margin</span>=<span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #000066;">bottom-margin</span>=<span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #000066;">subtitle-fps</span>=<span style="color: #ff0000;">&quot;25&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">movie-fps</span>=<span style="color: #ff0000;">&quot;25&quot;</span> <span style="color: #000066;">movie-width</span>=<span style="color: #ff0000;">&quot;720&quot;</span> <span style="color: #000066;">movie-height</span>=<span style="color: #ff0000;">&quot;574&quot;</span></span>
<span style="color: #009900;">                <span style="color: #000066;">force</span>=<span style="color: #ff0000;">&quot;yes&quot;</span></span>
<span style="color: #009900;">             <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/stream<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/subpictures<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$  spumux <span style="color: #660033;">-P</span> stream-subs.xml <span style="color: #000000; font-weight: bold;">&lt;</span> stream.ps <span style="color: #000000; font-weight: bold;">&gt;</span> stream-with-subs.ps
DVDAuthor::spumux, version 0.6.14.
Build options: gnugetopt magick iconv freetype
Send bugs to 
&nbsp;
INFO: <span style="color: #007800;">Locale</span>=fr_FR.UTF-<span style="color: #000000;">8</span>
INFO: Converting filenames to UTF-<span style="color: #000000;">8</span>
INFO: Detected subtitle <span style="color: #c20cb9; font-weight: bold;">file</span> format: subviewer
INFO: Opened iconv descriptor. <span style="color: #000000; font-weight: bold;">*</span>UTF-<span style="color: #000000;">8</span><span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span>ISO8859-<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">*</span>
INFO: Read <span style="color: #000000;">1267</span> subtitles
INFO: Unicode font: <span style="color: #000000;">242</span> glyphs.
INFO: Found EOF <span style="color: #000000; font-weight: bold;">in</span> .sub file.a written
INFO: <span style="color: #000000;">1267</span> subtitles added, <span style="color: #000000;">0</span> subtitles skipped, stream: <span style="color: #000000;">32</span>, offset: <span style="color: #000000;">0.12</span>
&nbsp;
Statistics:
- Processed <span style="color: #000000;">1267</span> subtitles.
- The longest display line had <span style="color: #000000;">37</span> characters.
- The maximum number of displayed lines was <span style="color: #000000;">2</span>.
- The normal display height of the font arial.ttf was <span style="color: #000000;">32</span>.
- The bottom display height of the font arial.ttf was <span style="color: #000000;">38</span>.
- The biggest subtitle box had <span style="color: #000000;">3118</span> bytes.</pre></div></div>

<p>When <code>spumux</code> finishes processing, you should have a <code>stream-with-subs.ps</code> file in your current working directory, and you should be able to test that it displays properly using VLC or your media player (VLC won't recognize the subtitles stream in the resulting PS, but don't worry, <code>spumux</code> has inserted it properly.</p>
<h2>Fonts</h2>
<p>Not liking Arial too much, I am still looking for the best font for the job, <code>spumux</code> comes with a set of fonts coming from the mplayer project, if you want to try out other fonts, they just have to be in <code>~/.spumux</code> just copy/link the <code>.ttf</code> files there.</p>
<h2>Timing issues</h2>
<p>Sometimes the subtitles are offset a bit and do not display at the right time. I have found a very handy tool named <a href="http://sourceforge.net/projects/sears/">Sears</a> that will allow you to edit the subtitles, change the text or timing, and more importantly offset the whole batch by one or 2 seconds if necessary.</p>
<p>Now it's time to move on the final step of our DVD authoring. Creating the DVD structure from the resulting MPEG2-PS.</p>
<p><strong><a href="http://arzur.net/2010/05/07/burning-mpeg2-ts-to-a-dvd/">Back to the summary article</a></strong><br />
<strong>Episode 1: </strong><strong><a href="http://arzur.net/2010/05/07/burning-mpeg2-ts-to-dvd-e01-cutpoints-and-demux-with-projectx/">Edit cutpoints and de-mux with ProjectX</a></strong><br />
<strong>Episode 2: <a href="http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e02-multiplex-audio-and-video-streams-into-a-dvd-compliant-ps/">Multiplex the resulting streams into a DVD-compatible PS using mplex</a></strong><br />
<strong>Episode 4: authoring the DVD</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e03-adding-the-subtitles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Burning MPEG2-TS to DVD &#8211; E02 &#8211; Multiplex audio and video streams into a DVD-compliant PS</title>
		<link>http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e02-multiplex-audio-and-video-streams-into-a-dvd-compliant-ps/</link>
		<comments>http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e02-multiplex-audio-and-video-streams-into-a-dvd-compliant-ps/#comments</comments>
		<pubDate>Sun, 16 May 2010 10:13:18 +0000</pubDate>
		<dc:creator>erwan</dc:creator>
				<category><![CDATA[video]]></category>
		<category><![CDATA[dvb]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[mpeg2]]></category>

		<guid isPermaLink="false">http://arzur.net/?p=54</guid>
		<description><![CDATA[So you've just finished extracting the video, audio and subtitles tracks from your TS, as described in the previous article of the serie. In the working directory, you should have the following files: total 8583424 -rw-r--r--  1 erwan  staff  1699268204  7 mai 09:43 stream.m2v -rw-r--r--  1 erwan  staff   207926016  7 mai 09:43 stream.mp2 -r-xr-xr-x [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Farzur.net%2F2010%2F05%2F16%2Fburning-mpeg2-ts-to-dvd-e02-multiplex-audio-and-video-streams-into-a-dvd-compliant-ps%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Farzur.net%2F2010%2F05%2F16%2Fburning-mpeg2-ts-to-dvd-e02-multiplex-audio-and-video-streams-into-a-dvd-compliant-ps%2F&amp;source=zuzur&amp;style=compact&amp;service=bit.ly&amp;service_api=R_0f41ee6dc559533f38d25e8df96d20fd&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>So you've just finished extracting the video, audio and subtitles tracks from your TS, as described in the <a href="http://arzur.net/2010/05/07/burning-mpeg2-ts-to-dvd-e01-cutpoints-and-demux-with-projectx/">previous article</a> of the serie.</p>
<p>In the working directory, you should have the following files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">total <span style="color: #000000;">8583424</span>
<span style="color: #660033;">-rw-r--r--</span>  <span style="color: #000000;">1</span> erwan  staff  <span style="color: #000000;">1699268204</span>  <span style="color: #000000;">7</span> mai 09:<span style="color: #000000;">43</span> stream.m2v
<span style="color: #660033;">-rw-r--r--</span>  <span style="color: #000000;">1</span> erwan  staff   <span style="color: #000000;">207926016</span>  <span style="color: #000000;">7</span> mai 09:<span style="color: #000000;">43</span> stream.mp2
<span style="color: #660033;">-r-xr-xr-x</span>  <span style="color: #000000;">1</span> erwan  staff  <span style="color: #000000;">2487420480</span>  <span style="color: #000000;">6</span> mai <span style="color: #000000;">21</span>:<span style="color: #000000;">22</span> stream.ts
<span style="color: #660033;">-rw-r--r--</span>  <span style="color: #000000;">1</span> erwan  staff       <span style="color: #000000;">82010</span>  <span style="color: #000000;">7</span> mai 09:<span style="color: #000000;">43</span> stream<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">889</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>.srt
<span style="color: #660033;">-rw-r--r--</span>  <span style="color: #000000;">1</span> erwan  staff        <span style="color: #000000;">3232</span>  <span style="color: #000000;">7</span> mai 09:<span style="color: #000000;">43</span> stream_log.txt</pre></div></div>

<p><code>stream.m2v</code> is the video track, <code>stream.mp2</code> is the audio track, the subtitles have been extracted into <code>stream[889].srt</code>.</p>
<p>You're going to build a DVD-compliant PS file using <code>mplex</code>. <code>mplex</code> is part of the mjpegtools program suite, you can install them with your package manager, on my my Mac, I used macports to install it (<code>port install mjpegtools</code>).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19</span>:<span style="color: #000000;">10</span>:02<span style="color: #7a0874; font-weight: bold;">&#93;</span>-erwan<span style="color: #000000; font-weight: bold;">@</span>ip-<span style="color: #000000;">192</span>-<span style="color: #000000;">168</span>-<span style="color: #000000;">224</span>-<span style="color: #000000;">58</span>:~<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>article <span style="color: #000000; font-weight: bold;">&amp;</span>gt; mplex <span style="color: #660033;">-f8</span> <span style="color: #660033;">-o</span> stream.ps stream.m2v stream.mp2
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> mplex version 1.9.0 <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.2.7 <span style="color: #007800;">$Date</span>: <span style="color: #000000;">2006</span><span style="color: #000000; font-weight: bold;">/</span>02<span style="color: #000000; font-weight: bold;">/</span>01 <span style="color: #000000;">22</span>:<span style="color: #000000;">23</span>:01 $<span style="color: #7a0874; font-weight: bold;">&#41;</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> File stream.m2v looks like an MPEG Video stream.
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> File stream.mp2 looks like an MPEG Audio stream.
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Video stream <span style="color: #000000;">0</span>: profile <span style="color: #000000;">8</span> selected - ignoring non-standard options<span style="color: #000000; font-weight: bold;">!</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Found <span style="color: #000000;">1</span> audio streams and <span style="color: #000000;">1</span> video streams
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Selecting dvdauthor DVD output profile
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Multiplexing video program stream<span style="color: #000000; font-weight: bold;">!</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Scanning <span style="color: #000000; font-weight: bold;">for</span> header info: Video stream e0 <span style="color: #7a0874; font-weight: bold;">&#40;</span>stream.m2v<span style="color: #7a0874; font-weight: bold;">&#41;</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> VIDEO STREAM: e0
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Frame width     : <span style="color: #000000;">720</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Frame height    : <span style="color: #000000;">576</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Aspect ratio    : <span style="color: #000000;">4</span>:<span style="color: #000000;">3</span> display
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Picture rate    : <span style="color: #000000;">25.000</span> frames<span style="color: #000000; font-weight: bold;">/</span>sec
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Bit rate        : <span style="color: #000000;">5430400</span> bits<span style="color: #000000; font-weight: bold;">/</span>sec
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Vbv buffer <span style="color: #c20cb9; font-weight: bold;">size</span> : <span style="color: #000000;">229376</span> bytes
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> CSPF            : <span style="color: #000000;">0</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Scanning <span style="color: #000000; font-weight: bold;">for</span> header info: Audio stream c0 <span style="color: #7a0874; font-weight: bold;">&#40;</span>stream.mp2<span style="color: #7a0874; font-weight: bold;">&#41;</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> MPEG AUDIO STREAM: c0
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Audio version  : <span style="color: #000000;">1.0</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Layer          :        <span style="color: #000000;">2</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> CRC checksums  :      <span style="color: #c20cb9; font-weight: bold;">yes</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Bit rate       :    <span style="color: #000000;">32768</span> bytes<span style="color: #000000; font-weight: bold;">/</span>sec <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">256</span> kbit<span style="color: #000000; font-weight: bold;">/</span>sec<span style="color: #7a0874; font-weight: bold;">&#41;</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Frequency      :     <span style="color: #000000;">48000</span> Hz
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Mode           :        <span style="color: #000000;">0</span> stereo
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Mode extension :        <span style="color: #000000;">0</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Copyright bit  :        <span style="color: #000000;">0</span> no copyright
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Original<span style="color: #000000; font-weight: bold;">/</span>Copy  :        <span style="color: #000000;">0</span> copy
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Emphasis       :        <span style="color: #000000;">0</span> none
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> SYSTEMS<span style="color: #000000; font-weight: bold;">/</span>PROGRAM stream:
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> rough-guess multiplexed stream data rate    : <span style="color: #000000;">5810448</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> target data-rate specified               : <span style="color: #000000;">10080000</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Setting specified specified data rate: <span style="color: #000000;">10080000</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Run-in delay = <span style="color: #000000;">7200</span> Video delay = <span style="color: #000000;">7200</span> Audio delay = <span style="color: #000000;">10800</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> New sequence commences...
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Video e0: <span style="color: #007800;">buf</span>=      <span style="color: #000000;">0</span> <span style="color: #007800;">frame</span>=000000 <span style="color: #007800;">sector</span>=00000000
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Audio c0: <span style="color: #007800;">buf</span>=      <span style="color: #000000;">0</span> <span style="color: #007800;">frame</span>=000000 <span style="color: #007800;">sector</span>=00000000
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Scanned to end AU <span style="color: #000000;">162441</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> STREAM e0 completed
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> STREAM c0 completed
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Multiplex completion at <span style="color: #007800;">SCR</span>=<span style="color: #000000;">584792210</span>.
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Video e0: completed
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Audio c0: completed
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> VIDEO_STATISTICS: e0
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Video Stream length:  <span style="color: #000000;">1699268204</span> bytes
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Sequence headers:     <span style="color: #000000;">4820</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Sequence ends   :        <span style="color: #000000;">1</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> No. Pictures    :   <span style="color: #000000;">162442</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> No. Groups      :     <span style="color: #000000;">4820</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> No. I Frames    :     <span style="color: #000000;">4820</span> avg. <span style="color: #c20cb9; font-weight: bold;">size</span> <span style="color: #000000;">32405</span> bytes
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> No. P Frames    :    <span style="color: #000000;">49328</span> avg. <span style="color: #c20cb9; font-weight: bold;">size</span> <span style="color: #000000;">12305</span> bytes
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> No. B Frames    :   <span style="color: #000000;">108294</span> avg. <span style="color: #c20cb9; font-weight: bold;">size</span>  <span style="color: #000000;">8643</span> bytes
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Average bit-rate :  <span style="color: #000000;">2092000</span> bits<span style="color: #000000; font-weight: bold;">/</span>sec
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Peak bit-rate    :  <span style="color: #000000;">5431600</span>  bits<span style="color: #000000; font-weight: bold;">/</span>sec
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> BUFFERING min <span style="color: #000000;">15</span> Buf max <span style="color: #000000;">153570</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> AUDIO_STATISTICS: c0
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Audio stream length <span style="color: #000000;">207926016</span> bytes.
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Syncwords      :   <span style="color: #000000;">270737</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Frames         :   <span style="color: #000000;">270737</span> padded
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> Frames         :        <span style="color: #000000;">0</span> unpadded
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> BUFFERING min <span style="color: #000000;">15</span> Buf max <span style="color: #000000;">779</span>
INFO: <span style="color: #7a0874; font-weight: bold;">&#91;</span>mplex<span style="color: #7a0874; font-weight: bold;">&#93;</span> MUX STATUS: no under-runs detected.</pre></div></div>

<p>Ok, now <code>stream.ps</code> contains a DVD-compliant stream that you'll be able to use for authoring the DVD. Before going further make sure that you can play it with your media player (<a href="http://videolan.org">VLC</a> comes handy), and that the audio and video tracks are in sync ...</p>
<p>Now, it's time to insert the subtitles track.</p>
<p><strong><a href="http://arzur.net/2010/05/07/burning-mpeg2-ts-to-a-dvd/">Back to the summary article</a></strong><br />
<strong>Episode 1 : <a href="http://arzur.net/2010/05/07/burning-mpeg2-ts-to-dvd-e01-cutpoints-and-demux-with-projectx/">Edit cutpoints and de-mux with ProjectX</a></strong><br />
<strong>Episode 3: <a href="http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e03-adding-the-subtitles/">adding the subtitles</a></strong><br />
<strong>Episode 4: authoring the DVD</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e02-multiplex-audio-and-video-streams-into-a-dvd-compliant-ps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Burning MPEG2-TS to DVD &#8211; E01 &#8211; cutpoints and demux with ProjectX</title>
		<link>http://arzur.net/2010/05/07/burning-mpeg2-ts-to-dvd-e01-cutpoints-and-demux-with-projectx/</link>
		<comments>http://arzur.net/2010/05/07/burning-mpeg2-ts-to-dvd-e01-cutpoints-and-demux-with-projectx/#comments</comments>
		<pubDate>Fri, 07 May 2010 09:01:52 +0000</pubDate>
		<dc:creator>erwan</dc:creator>
				<category><![CDATA[video]]></category>
		<category><![CDATA[dvb]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[mpeg2]]></category>

		<guid isPermaLink="false">http://www.arzur.net/?p=24</guid>
		<description><![CDATA[This is the first episode of the "Burning MPEG2-TS to DVD" serie of articles. In this one, we'll see how to cut MPEG2 and extract the streams from our MPEG2-TS file. Say you got a file name "stream.ts" from your decoder. Start ProjectX. The UI is not very intuitive, but i'll try to walk you [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Farzur.net%2F2010%2F05%2F07%2Fburning-mpeg2-ts-to-dvd-e01-cutpoints-and-demux-with-projectx%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Farzur.net%2F2010%2F05%2F07%2Fburning-mpeg2-ts-to-dvd-e01-cutpoints-and-demux-with-projectx%2F&amp;source=zuzur&amp;style=compact&amp;service=bit.ly&amp;service_api=R_0f41ee6dc559533f38d25e8df96d20fd&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This is the first episode of the "Burning MPEG2-TS to DVD" serie of articles. In this one, we'll see how to cut MPEG2 and extract the streams from our MPEG2-TS file.</p>
<p>Say you got a file name "stream.ts" from your decoder.</p>
<p>Start ProjectX. The UI is not very intuitive, but i'll try to walk you through it so you know your way around <img src='http://arzur.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://www.arzur.net/wp-content/uploads/2010/05/Image-10.png"><img class="aligncenter size-medium wp-image-12" title="ProjectX startup" src="http://www.arzur.net/wp-content/uploads/2010/05/Image-10-300x214.png" alt="" width="300" height="214" /></a></p>
<p>open stream.ts, the preview window in the middle should display the list of streams in the container that ProjectX detected.</p>
<p><a href="http://www.arzur.net/wp-content/uploads/2010/05/Image-24.png"><img class="aligncenter size-medium wp-image-31" title="Image 24" src="http://www.arzur.net/wp-content/uploads/2010/05/Image-24-300x164.png" alt="" width="300" height="164" /></a></p>
<p>Take note of the PID of every streams you are interested in (here it's 0xA2 -&gt; video, 0x59 -&gt; original soudtrack, and 0x26 for the subtitles). The stream list usually doesn't stay long before returning back to the preview mode. If it disappears, just click on the file name in the list at the bottom of the window.</p>
<p>In the right part of the window, you can specify the list of the PIDs that you want to extract ("PES(&amp;Sub)-ID/PID list").</p>
<p style="text-align: left;"><a href="http://www.arzur.net/wp-content/uploads/2010/05/Image-15.png"><img class="size-full wp-image-18 aligncenter" title="Selecting streams by specifying theid IDs" src="http://www.arzur.net/wp-content/uploads/2010/05/Image-15.png" alt="" width="228" height="214" /></a></p>
<p style="text-align: left;">Add each interesting streams to this list, including the subtitle one (0x26 here)</p>
<p>Now you are ready to extract the streams from the TS. Click the "prepare &gt;&gt;" button on the left of the main window.</p>
<p style="text-align: center;"><a href="http://www.arzur.net/wp-content/uploads/2010/05/Image-21.png"><img class="size-medium wp-image-25 aligncenter" title="Process Window" src="http://www.arzur.net/wp-content/uploads/2010/05/Image-21-300x193.png" alt="" width="300" height="193" /></a></p>
<p style="text-align: left;">Before starting the process you'll need to adjust some options, mainly related to subtitles. Open the "pre-settings" windows in "PreSettings -&gt; Presettings".</p>
<p style="text-align: center;"><a href="http://www.arzur.net/wp-content/uploads/2010/05/Image-22.png"><img class="size-medium wp-image-26 aligncenter" title="Image 22" src="http://www.arzur.net/wp-content/uploads/2010/05/Image-22-300x253.png" alt="" width="300" height="253" /></a></p>
<p style="text-align: left;">go to the subtitle tab on the left, and enter the teletext page number for the subtitles. On my satellite feed, it is page 889, but this number depends on the broadcaster, you have to fiddle around a bit to find it.</p>
<p style="text-align: left;">Choosing "basic latin" as language will encode the resulting file in ISO-8859-1.</p>
<p style="text-align: left;">use "subtitle export formats": SRT (subrip)</p>
<p>You are ready :</p>
<p style="text-align: left;"><a href="http://www.arzur.net/wp-content/uploads/2010/05/Image-191.png"><img class="size-medium wp-image-27 aligncenter" title="Image 19" src="http://www.arzur.net/wp-content/uploads/2010/05/Image-191-300x94.png" alt="" width="300" height="94" /></a></p>
<p style="text-align: left;">press on the "play" button, and projectX will start working</p>
<p>After the end of the process, voilà !</p>
<p style="text-align: center;"><a href="http://www.arzur.net/wp-content/uploads/2010/05/Image-23.png"><img class="size-medium wp-image-29 aligncenter" title="Image 23" src="http://www.arzur.net/wp-content/uploads/2010/05/Image-23-300x53.png" alt="" width="300" height="53" /></a></p>
<p>The following files are produced:</p>
<ul>
<li>stream.m2v - the video track</li>
<li>stream.mp2 - the audio track</li>
<li>stream[889].srt - subtitles</li>
</ul>
<p>The next article will discuss re-multiplexing the video and audio tracks into a DVD-compliant MPEG2-PS file</p>
<p><strong><a href="http://arzur.net/2010/05/07/burning-mpeg2-ts-to-a-dvd/">Back to the summary article</a></strong><br />
<strong>Episode 2: <a href="http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e02-multiplex-audio-and-video-streams-into-a-dvd-compliant-ps/">Multiplex the resulting streams into a DVD-compatible PS using mplex</a></strong><br />
<strong>Episode 3: <a href="http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e03-adding-the-subtitles/">adding the subtitles</a></strong><br />
<strong>Episode 4: authoring the DVD</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://arzur.net/2010/05/07/burning-mpeg2-ts-to-dvd-e01-cutpoints-and-demux-with-projectx/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Burning MPEG2-TS to a DVD</title>
		<link>http://arzur.net/2010/05/07/burning-mpeg2-ts-to-a-dvd/</link>
		<comments>http://arzur.net/2010/05/07/burning-mpeg2-ts-to-a-dvd/#comments</comments>
		<pubDate>Fri, 07 May 2010 08:41:12 +0000</pubDate>
		<dc:creator>erwan</dc:creator>
				<category><![CDATA[Non classé]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[dvb]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[mpeg2]]></category>

		<guid isPermaLink="false">http://www.arzur.net/?p=7</guid>
		<description><![CDATA[For years, i have been using my dreambox to record TV shows and enjoy them when I fancy. I especially like the fact that i can skip commercials. Anyway, a while ago a good friend asked if I could make a DVD out of a documentary I had recorded on the box's HDD. "no problem, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Farzur.net%2F2010%2F05%2F07%2Fburning-mpeg2-ts-to-a-dvd%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Farzur.net%2F2010%2F05%2F07%2Fburning-mpeg2-ts-to-a-dvd%2F&amp;source=zuzur&amp;style=compact&amp;service=bit.ly&amp;service_api=R_0f41ee6dc559533f38d25e8df96d20fd&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>For years, i have been using my <a href="http://www.dream-multimedia-tv.de/en">dreambox</a> to record TV shows and enjoy them when I fancy. I especially like the fact that i can skip commercials. Anyway, a while ago a good friend asked if I could make a DVD out of a documentary I had recorded on the box's HDD.</p>
<p>"no problem, I'll burn it rightaway", I answered ...</p>
<p>could I be more foolish ?</p>
<p>It took me more than a month to figure out what were the steps requested to achieve this. At the beginning, I was thinking that simply building a DVD structure (dvdauthor) out of the MPEG2 Transport Stream picked up from the receiver would work. After all, a DVD player can read MPEG2, and everything needed is inside the file, including the video track, the audio in 2 languages and the subtitles !</p>
<p>DVD players can only read MPEG2 <span style="text-decoration: underline;">Program Streams</span> and what you get from a DVB tuner are <span style="text-decoration: underline;">Program Streams</span>, totally different beasts !</p>
<h2>Some background about MPEG2</h2>
<p>The MPEG2 standard defines two kind of containers for a variety of streams that are multiplexed (or muxed) together. Transport streams (MPEG2-TS) are used by most broadcasted programs such as DVB (-S for satellite, -T for terrestial, ...) and Program Streams (MPEG2-PS) for anything that could be contained in file-based storage (with a beginning and an end). As stated in this <a href="http://en.wikipedia.org/wiki/MPEG-2">Wikipedia article</a>, the two formats are "different, but related", and for this reason, you can't just dump a program you've recorded on a DVD and hope that your player will be happy with it.</p>
<p>Additionally, TS are inherently resistant to broadcasting errors (reception problems, rain on the satellite dish, etc ...), and have support to allow players to resynchronize the video and audio tracks when it jumps. PS don't provide that, and just converting the TS to a PS would progressively make the video and audio out of sync when playing it back.</p>
<p>Making a proper PS for inclusion in a DVD from a TS requires a lot of steps that I'm going to describe in this article. Hold your breath <img src='http://arzur.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>My requirements for this DVD-burning project are:</p>
<ol>
<li>being able to watch movies with their <strong>original soundtrack</strong>. I just can't bear the french soundtrack they make us endure in France (and it's actually a <strong>law</strong> here. You can't broadcast movies with the original soundtrack before very late at night if you're not a premium channel)</li>
<li><strong>subtitles</strong>. I can enjoy most movies in english, but i like to have subtitles. Movies recorded from DVB streams in France, contain, in a very old-fashioned way, another MPEG stream, containing teletext encoded text on a special page (889 for french). Mind it, your DVD player will not be happy with those either !</li>
</ol>
<p>I have found many user-friendly tools with nice GUI such as MPEGStreamClip for OSX, that would have allowed me to perform most of the step outlined below, but they always fall short on some of my requirements. For instance I could not make MPEGStreamClip include subtitles from the teletext stream into the file it produces. Other solution will not allow you to keep the original soundtrack. So my solution involves a lot of command-line tools and needs you to be pretty familiar with UNIX, and not afraid by a terminal window.</p>
<p><strong>Something worth noting: </strong><em>With the recent advent of high-definition, decoders such as Free's FreeBOX-HD still produces MPEG2-TS files, but with the video track encoded using the H-264 codec. I couldn't make ProjectX cut/edit those files but it can still demux them. I've not tried that, but converting the video to MPEG-video and follow the same process should be possible. I guess you would have to re-encode them with a lower resolution, as MPEG2 in HD would use a HUGE amount of space and would certainly not fit in a 4.7GB DVD</em></p>
<div>You've been warned and can go on reading <img src='http://arzur.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </div>
<h2>The tools we'll need</h2>
<ul>
<li><a href="http://sourceforge.net/projects/project-x/">ProjectX</a>: the swiss-army knife of MPEG-2. The interface is not very intuitive, but after a while, you can figure it out pretty easily and get it to do what you want. We're going to use this tool to extract the video, audio and subtitle tracks from the TS.</li>
<li><a href="http://mjpeg.sourceforge.net">mplex</a>: part of the mjpeg-tools, this command-line tool allows to build a DVD-compliant Program Stream using the different tracks extracted using ProjectX</li>
<li>spumux: part of the dvdauthor suite, allows you to add a dvd-compliant stream of subtitles from many different format (including subrip files !) to a MPEG2-PS</li>
<li>dvdauthor: will build the standard DVD structure (AUDIO_TS and VIDEO_TS folders) from a MPEG2-PS</li>
</ul>
<p>Say we downloaded a file named "stream.ts" from our decoder. Our goal is to use it to produce a valid DVD structure from it. In my serie of articles, I am going to walk you through converting that TS to a valid DVD structure that you can use to burn a DVD for your hardware DVD player.</p>
<p><strong>Episode 1: </strong><strong><a href="http://arzur.net/2010/05/07/burning-mpeg2-ts-to-dvd-e01-cutpoints-and-demux-with-projectx/">Edit cutpoints and de-mux with ProjectX</a></strong><br />
<strong>Episode 2: <a href="http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e02-multiplex-audio-and-video-streams-into-a-dvd-compliant-ps/">Multiplex the resulting streams into a DVD-compatible PS using mplex</a></strong><br />
<strong>Episode 3: <a href="http://arzur.net/2010/05/16/burning-mpeg2-ts-to-dvd-e03-adding-the-subtitles/">adding the subtitles</a></strong></p>
<p><strong>Episode 4: authoring the DVD</strong></p>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://arzur.net/2010/05/07/burning-mpeg2-ts-to-a-dvd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

