<?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>Onlydarksets &#187; ffmpeg</title>
	<atom:link href="http://onlydarksets.com/tag/ffmpeg/feed/" rel="self" type="application/rss+xml" />
	<link>http://onlydarksets.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 14 Jan 2010 14:36:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Transcoding in Sage</title>
		<link>http://onlydarksets.com/2009/02/04/transcoding-in-sage-2/</link>
		<comments>http://onlydarksets.com/2009/02/04/transcoding-in-sage-2/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 16:30:45 +0000</pubDate>
		<dc:creator>onlydarksets</dc:creator>
				<category><![CDATA[DVRMSToolbox]]></category>
		<category><![CDATA[SageTV]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[babgvant]]></category>
		<category><![CDATA[ffmpeg]]></category>

		<guid isPermaLink="false">http://onlydarksets.wordpress.com/?p=402</guid>
		<description><![CDATA[I finally got around to rebuilding my HTPC (does anyone call them that anymore?) yesterday, so now I need to set my sights on getting file conversions working again.  I&#8217;m pretty set on using DTb for file monitoring and processing control.  For transcoding, I was going to use VLC (or possibly Handbrake), but I might [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got around to rebuilding my HTPC (does anyone call them that anymore?) yesterday, so now I need to set my sights on getting file conversions working again.  I&#8217;m pretty set on using <a href="http://www.babgvant.com/" target="_blank">DTb</a> for file monitoring and processing control.  For transcoding, <a href="http://onlydarksets.com/2008/07/06/mp4-tagging/" target="_self">I was going to use VLC</a> (or possibly <a href="http://handbrake.fr/" target="_blank">Handbrake</a>), but I might look at <a href="http://ffdshow.faireal.net/mirror/ffmpeg/" target="_blank">ffmpeg</a> instead.  Also, Sage <a href="http://www.google.com/search?q=SageTVTranscoder+site%3Asagetv.com" target="_blank">includes a transcoder</a>, which is apparently based on ffmpeg, but I&#8217;m not sure it adds anything over ffmpeg for me.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://onlydarksets.com/2009/02/04/transcoding-in-sage-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Roll your own YouTube (mirror)</title>
		<link>http://onlydarksets.com/2009/01/29/roll-your-own-youtube-mirror/</link>
		<comments>http://onlydarksets.com/2009/01/29/roll-your-own-youtube-mirror/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 19:54:43 +0000</pubDate>
		<dc:creator>onlydarksets</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[ffmpeg]]></category>

		<guid isPermaLink="false">http://onlydarksets.wordpress.com/?p=738</guid>
		<description><![CDATA[A while back I found a good post (via FlashInsider) that detailed how to create a video sharing site, but when I went to look at it recently, it was replaced by a placeholder page written in German.  Thanks to Google cache, here is a mirror of it, including comments.  I&#8217;m not planning on hosting [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I found a good post (via <a href="http://www.flashinsider.com/2006/07/26/how-to-create-your-own-youtube-site/" target="_blank">FlashInsider</a>) that detailed how to create a video sharing site, but when I went to look at it recently, <a href="http://blog.go4teams.com/?p=56" target="_blank">it was replaced by a placeholder page written in German</a>.  Thanks to Google cache, here is a mirror of it, including comments.  I&#8217;m not planning on hosting a YouTube site, but the FLV/FlowPlayer stuff is interesting.</p>
<p><strong>UPDATE</strong>: It&#8217;s back now, but I&#8217;m leaving this here anyway.</p>
<p><span id="more-738"></span></p>
<div style="border:1px solid #999999;background:#ffffff none repeat scroll 0 0;margin:-1px -1px 0;padding:0;">
<div style="border:1px solid #999999;background:#dddddd none repeat scroll 0 0;font-family:arial,sans-serif;font-style:normal;font-variant:normal;font-size:13px;line-height:normal;color:#000000;font-weight:normal;text-align:left;margin:12px;padding:8px;">This is Google&#8217;s cache of <a href="http://blog.go4teams.com/?p=56">http://blog.go4teams.com/?p=56</a>. It is a snapshot of the page as it appeared on Jan 23, 2009 02:12:53 GMT. The <a href="http://blog.go4teams.com/?p=56">current page</a> could have changed in the meantime. <a href="http://www.google.com/intl/en/help/features_list.html#cached">Learn more</a></p>
<div style="float:right;"><a href="http://74.125.113.132/search?q=cache:y4NP6cOBFZoJ:blog.go4teams.com/%3Fp%3D56+http://blog.go4teams.com/%3Fp%3D56&amp;hl=en&amp;client=firefox-a&amp;gl=us&amp;strip=1">Text-only version</a></div>
<div>These search terms are highlighted: <span style="background:#a0ffff none repeat scroll 0 0;color:black;font-weight:bold;">p</span> <span style="background:#a0ffff none repeat scroll 0 0;color:black;font-weight:bold;">56</span> These terms only appear in links pointing to this page: <span style="font-weight:bold;">http</span> <span style="font-weight:bold;">blog</span> <span style="font-weight:bold;">go4teams</span> <span style="font-weight:bold;">com</span></div>
</div>
</div>
<div style="position:relative;"><!-- leave this for stats --></p>
<div id="page">
<div id="header">
<div id="headerimg">
<h1><a href="http://blog.go4teams.com/">DRM &#8211; Daniel’s Random Mutterings</a></h1>
<div class="description">What I Read; What I Have Read; and stuff I pick up and drag along</div>
</div>
</div>
<hr />
<div style="margin-left:15px;"></div>
<div id="content" class="widecolumn">
<div class="navigation">
<div class="alignleft">« <a href="http://blog.go4teams.com/archives/pet-peeves-in-grammar-34/53">Pet Peeves In Grammar, #34</a></div>
<div class="alignright"><a href="http://blog.go4teams.com/archives/i-was-dugg/60">I was dugg!</a> »</div>
</div>
<div id="post-56" class="post">
<h2><a title="Video Blogging using Django and Flash(tm) Video (FLV)" rel="bookmark" href="http://blog.go4teams.com/archives/video-blogging-using-django-and-flashtm-video-flv/56">Video Blogging using Django and Flash(tm) Video (FLV)</a></h2>
<p><!-- google_ad_section_start --></p>
<div class="entrytext">I just added Flash-based (FLV) video blogging support to my <a href="http://www.djangoproject.com/">Django</a>-powered travel portal site, <a href="http://www.trogger.de/">trogger.de</a>. The whole process is surprisingly simple and straightforward and can be done entirely with free (FLOSS) tools.The video publishing workflow consists of the following parts:</p>
<ul>
<li>A Django model to store our video and associated information</li>
<li>An upload form where the user can upload a video</li>
<li>Converting the video into a format usable on the Web</li>
<li>Extracting additional details</li>
<li>Playing the video in the Web browser</li>
<li>Making the player a bit friendlier</li>
<li>Advanced features</li>
</ul>
<p>Following this simple workflow, <a href="http://www.trogger.de/">trogger.de</a> allows users to write and submit a blog post. Once that’s submitted, the user can add one (!) video file to it. When later viewing the blog entry, the attached video is shown in the browser.</p>
<h2>The Django model</h2>
<p>The Django model for storing the video is rather straightforward. In addition to storing the Video (or, rather, a reference to the video file) in a FileField, I’ve added a reference to the blog submission with which the video is related (I use this to look up the video when browsing the blog). Here’s my model, VideoSubmission:</p>
<pre>class VideoSubmission(models.Model):
    videoupload = models.FileField (upload_to='videoupload')
    relatedsubmission = models.ForeignKey(Submission, null=True)
    comment = models.CharField( maxlength=250, blank=True )
    flvfilename = models.CharField( maxlength=250, blank=True, null=True )</pre>
<p>In addition to the video FileField itself, I’ve added a “flvfilename” field to store the name of the converted movie file (see below).</p>
<h2>Uploading the video</h2>
<p>Video uploading is done using a normal File upload form. In the view for the upload form, we need to add the FormFields for the file upload fields created by Django:</p>
<pre>def v_addvideo(request, submissionid):
    manipulator=VideoSubmission.AddManipulator()
    form=FormWrapper(manipulator,{},{})
    params = {'userAccount':request.user,'form':form,}
    c = Context( request, params)
    t = loader.get_template('video/addvideo.html')
    sub = Submission.objects.get(pk=submissionid)
    params['submission'] = sub
    return HttpResponse( t.render( c ) )</pre>
<p>Our addvideo.html is pretty much the simplest upload form imaginable:</p>
<pre>&lt;form action="/video/upload/" method="post" enctype="multipart/form-data"&gt;
&lt;table&gt;
  &lt;input type="hidden" name="relatedsubmission_id" value="{{submission.id}}" /&gt;
    &lt;tr valign="top"&gt;
      &lt;td&gt;Video hochladen:&lt;br/&gt;(Nur AVI und FLV werden akzeptiert)&lt;/td&gt;
      &lt;td&gt;{{ form.videoupload}} {{ form.videoupload_file }}&lt;br/&gt;
      Kommentar: &lt;input type="text" name="comment"   style="width:100%" maxlength="250"&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr valign="top"&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;&lt;input type="submit" Value="Hochladen"/&gt; &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;</pre>
<p>I’ve added the related submission ID as a hidden field, so that this gets submitted back to the upload process and I can create a link between the video and the blog entry.</p>
<h2>Converting the video for use in the site</h2>
<p>The users are asked to upload AVI videos to the site, but we cannot play AVI videos directly in the browser (at least not in a browser-independent manner). A good way to publish videos for viewing in a browser is using FLV (Flash(tm) Video) format. This is what YouTube, Google Video and a whole host of other sites use. If it’s good enough for them, it’s good enough for me!</p>
<h3>Converting to FLV</h3>
<p>So, how to convert the AVI video the user uploaded to a usable FLV format? Luckily, the OSS package <a href="http://ffmpeg.mplayerhq.hu/">ffmpeg</a> [2] provides this conversion functionality (plus a wide range of other video conversion features one of which we’ll come to later on). The good thing about ffmpeg is that it is controlled entirely from the command-line and can be run in headless environments — this is vital for using it on an application server. Most other FLV conversion tools were either for Windows or came with some form of Gnome or KDE gui which wouldn’t have worked on my hosted Linux box.</p>
<p>The basic command for converting a video into FLV format is (see [1] in resources):<br />
<code><br />
ffmpeg -i [sourcefile.avi] -acodec mp3 -ar 22050 -ab 32 -f flv -s 320×240  [destfile.flv]<br />
</code></p>
<h3>Adding FLV metadata</h3>
<p>This command creates a simple FLV format file, containing the video and audio streams. In addition, FLV files need meta-information such as duration, frames, etc. FLV movie players use this information to calculate progress bar sliders and allow the user to fast-forward or reverse through the video. For reasons which I didn’t bother to research, ffmpeg does not add this information. But there is a package which can: flvtool2 (see [3]). Using this tool, we can add FLV meta-information with the following command:<br />
<code><br />
flvtool2 -U [flvfile]<br />
</code></p>
<p>(Warning, Djangoists — flvtool2 is written in Ruby. Please check your religious language preferences at the door and pick them up as you leave. Thank you).</p>
<h3>Adding a video thumbnail</h3>
<p>Blog entries in <a>trogger.de</a> can include pictures uploaded by the users. One of these pictures is displayed as a small preview when showing the blog posting (e.g. in the blog overview, or in the list of the latest blog submissions). Wouldn’t it be nice if we could also add a thumbnail for a video submission, so that the blog’s reader can get a first idea of what to expect? I think it would. And, again, ffmpeg comes to the rescue.</p>
<p>ffmpeg can extract single frames from a video stream, storing them in still image format. The command for doing this is:</p>
<p><code><br />
ffmpeg -y -i [videofile] -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s 320×240 [thumbnailimage.png]<br />
</code></p>
<h3>Putting it all together</h3>
<p>With these individual steps, it’s EASY to put together a video conversion function which kicks in once a user has uploaded a video file. Since we have the information which video the user uploaded with the form, we convert this video into FLV format, add metadata and create a thumbnail image:</p>
<pre>def convertvideo (video):
    if video is None:
        return "Kein Video im Upload gefunden"
    filename = video.videoupload
    print "Konvertiere Quelldatei: %s" + filename
    if filename is None:
        return "Video mit unbekanntem Dateinamen"
    sourcefile = "%s%s" % (settings.MEDIA_ROOT,filename)
    flvfilename = "%s.flv" % video.id
    thumbnailfilename = "%svideos/flv/%s.png" % (settings.MEDIA_ROOT, video.id)
    targetfile = "%svideos/flv/%s" % (settings.MEDIA_ROOT, flvfilename)
    ffmpeg = "ffmpeg -i %s -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 %s" % (sourcefile,  targetfile)
    grabimage = "ffmpeg -y -i %s -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s 320x240 %s " % (sourcefile, thumbnailfilename)
    flvtool = "flvtool2 -U %s" % targetfile
    print ("Source : %s" % sourcefile)
    print ("Target : %s" % targetfile)
    print ("FFMPEG: %s" % ffmpeg)
    print ("FLVTOOL: %s" % flvtool)
    try:
        ffmpegresult = commands.getoutput(ffmpeg)
        print "-------------------- FFMPEG ------------------"
        print ffmpegresult
        # Check if file exists and is &gt; 0 Bytes
        try:
            s = os.stat(targetfile)
            print s
            fsize = s.st_size
            if (fsize == 0):
                print "File is 0 Bytes gross"
                os.remove(targetfile)
                return ffmpegresult
            print "Dateigroesse ist %i" % fsize
        except:
            print sys.exc_info()
            print "File %s scheint nicht zu existieren" % targetfile
            return ffmpegresult
        flvresult = commands.getoutput(flvtool)
        print "-------------------- FLVTOOL ------------------"
        print flvresult
        grab = commands.getoutput(grabimage)
        print "-------------------- GRAB IMAGE ------------------"
        print grab
    except:
        print sys.exc_info()
        return sys.exc_info[1]
    video.flvfilename = flvfilename
    video.save()
    return None</pre>
<h3>Things to note</h3>
<p>I’m keeping the media diectory for the uploads and the media directory for the converted results separate. This way, I can later on easily clear the upload area if I decide I don’t need the source videos any more (after all, they eat up valuable hosting space), without having to bother about accidentally deleting the converted data. Yes, I’m sometimes stupid in breathtakingly dumb ways. Also I can exclude the source video files from the daily backup.</p>
<p>If something goes wrong with the conversion, I return the output message from the conversion tool and actually display this in the Web page, so the user can see if there was a problem. I’m not too sure this is a good idea, yet. ffmpeg puts pathnames into its output, so the error message is exposing potentially exploitable information about the directory setup of my server. You might want to consider replacing path names before dumping the output message.</p>
<p>The converted video file is created in a subdirectory of the media root and has the VideoSubmission model instance’s ID as a filename (35.flv). This will always be unique, so there’s no need to think about another unique naming scheme. The PNG image thumbnail also has the ID as a filename, but with a PNG extension (duh!).</p>
<h2>Playing the video in the Web browser</h2>
<p>Now that the video was uploaded and (hopefully) successfully converted, we need to provide a way of viewing it. For this, I use an FLV player component called <a href="http://flowplayer.sourceforge.net/">FlowPlayer</a>, avilable as a SourceForge project [4]. The FlowPlayer SWF is embedded into the page and parameters are provided based on information from the video. In the blog entry view, I look for a related video submission which I pass in the context as “video”. The view template populates the SWF parameters using information from the “video” instance:</p>
<pre>{% if video %}
&lt;div style="textalign:center; width:100%;"&gt;
&lt;center&gt;
&lt;object  type="application/x-shockwave-flash"
width="320" height="263" id="FlowPlayer" data="/showvideo/FlowPlayer.swf"&gt;
	&lt;param name="allowScriptAccess" value="sameDomain" /&gt;
	&lt;param name="movie" value="/showvideo/FlowPlayer.swf" /&gt;
	&lt;param name="quality" value="high" /&gt;
	&lt;param name="scale" value="noScale" /&gt;
	&lt;param name="wmode" value="transparent" /&gt;
	&lt;param name="flashvars" value="baseURL=/showvideo&amp;videoFile=flv/{{video.flvfilename}}&amp;autoPlay=false&amp;bufferLength=5&amp;loop=false&amp;progressBarColor1=0xAAAAAA&amp;progressBarColor2=0x555555&amp;autoBuffering=false&amp;splashImageFile=clicktoplay.jpg&amp;hideControls=false" /&gt;
&lt;p&gt;Dein Browser scheint kein Flash-Plugin installiert zu haben&lt;/p&gt;
&lt;/object&gt;
&lt;p&gt;
&lt;center&gt;
&lt;strong&gt;{{video.comment}}&lt;/strong&gt;
&lt;/center&gt;
&lt;/p&gt;
&lt;/center&gt;
&lt;/div&gt;
{% endif %}</pre>
<p>Note the inconspicuous “splashImageFile=clicktoplay.jpg” hidden in the jumble of FLV parameters. FlowPlayer provides a very simple way of specifying a “splash screen” image which is displayed in place of the video until the user clicks on the Flash player to view the video. I’ve created a trogger-themed splash screen and use this for all embedded video submissions:<br />
<img src="http://blog.go4teams.com/wp-content/uploads/2006/07/clicktoplay.jpg" alt="FlowPlayer splash screen" width="128" height="96" /></p>
<h2>The end result</h2>
<p>Thew end result is shown in the screenshot. A user-written blog entry, with an attached video which is played in the browser. Not bad for one day’s work, if I say so myself.<br />
<a href="http://blog.go4teams.com/wp-content/uploads/2006/07/mantavideo.gif"><br />
<img src="http://blog.go4teams.com/wp-content/uploads/2006/07/mantavideo.gif" border="0" alt="Manta Video in trogger page" width="400" /></a></p>
<h2>Conversion quality and size issues</h2>
<p>Quality of the converted FLV videos is pretty good, even at lower resolutions. Of course, YMMV or you may have other expectations. Using the conversion commands shown above, a 2.6MB camera movie was converted into an FLV file of 590kB. Depending on your intended use of the video (full-screen presentation?), and depending on how much bandwidth you want to burn, you may want to fiddle with some quality and compression parameters in ffmpeg.</p>
<h2>Housekeeping</h2>
<p>It is definitely a good idea to make sure that the FLV files are not actually served by Django, but directly by Apache (or even by another http server altogether). To serve the video files directly from Apache, we can exclude the video location “showvideo” from processing by Django by adding a section to the httpd.conf:</p>
<pre>Alias /showvideo/ "/path/to/my/media/root/video/"
&lt;Location "/showvideo/"&gt;
    SetHandler none
&lt;/Location&gt;</pre>
<p>Also, we should consider limiting the size of uploads, since we don’t want to drown in uploaded video (and we don’t want to get out-of-memory errors from Django, which holds the entires file upload in memory at least temporarily). As has been <a href="http://groups.google.com/group/django-users/msg/0562d78a613cb069">pointed out by Malcolm Tredinnick in the django-users group</a>, this can be achieved using the <a href="http://httpd.apache.org/docs/1.3/mod/core.html#limitrequestbody">LimitRequestBody directive</a>.</p>
<h2>Open Issues</h2>
<p>One issue that I haven’t been able to solve is adequate support for more video formats. Windows Media stuff provides so many proprietary formats, codecs, etc., that it’s hard even for a project such as ffmpeg to keep up. As a result, I’ve limited video upload to AVI files, and make it quite clear to the uploader that potentially the video he’s uploading cannot be used, due to format problems. AVI videos captured by my digital camera (such as the diving video in the screenshot) can be converted quite well. As soon as somebody recodes the video, converts it to WMV, there’s trouble (even more so if the video contains any Digital Restrictions Management). There are loads of forum entries in the Net discussing potential solutions. Since they all involved hacking additional (sometimes binary) codes into ffmpeg, I wasn’t adventurous enough to try them.</p>
<p>If anyone can point me at a reliable way of converting (unprotected) WMV files and other video formats into FLV format, I would be very grateful.</p>
<p>I discovered that MPlayer can also be used for such conversions and can also be run in a headless environment; since conversion with ffmpeg worked, I didn’t do any more experiments — maybe someone else can enlighten me as to wether MPlayer would actually be better or cope with more formats?</p>
<p>Also, I’m doing the video conversion in-line with the browser upload. This is OK for shorter videos, where I can make the user wait for a result. For larger video submissions it might be useful to decouple the video processing and do it in a separate thread, updating the blog entry when finished.</p>
<h2>Resources</h2>
<p>[1] <a href="http://www.summersault.com/community/weblog/2006/02/13/publishing-flash-videos-with-free-open-source-tools.html%3Cbr%20/%3E%E2%80%9C%3EPublishing%20Flash%20videos%20with%20free,%20open%20source%20tools%3Cbr%20/%3Ehttp://www.summersault.com/community/weblog/2006/02/13/publishing-flash-videos-with-free-open-source-tools.html%3C/p%3E%3Cp%3E%5B2%5D%20%3Ca%20href=">ffmpeg</a></p>
<p>http://ffmpeg.mplayerhq.hu/</p>
<p>[3] <a href="http://rubyforge.org/projects/flvtool2/">flvtool2</a></p>
<p>http://rubyforge.org/projects/flvtool2/</p>
<p>[4] <a href="http://flowplayer.sourceforge.net/">FlowPlayer</a></p>
<p>http://flowplayer.sourceforge.net/</p>
<p>Tags: <a rel="tag" href="http://technorati.com/tag/Django">Django</a>; <a rel="tag" href="http://technorati.com/tag/Python">Python</a>; <a rel="tag" href="http://technorati.com/tag/flv">FLV</a>; <a rel="tag" href="http://technorati.com/tag/video">video</a>; <a rel="tag" href="http://technorati.com/tag/trogger">trogger</a></p>
<p>P.S. You can check out a blog entry with video submission in my trogger blog at <a href="http://www.trogger.de/blog/8/60/mit-mantas-tauchen-vor-machchafushi/fullentry/">http://www.trogger.de/blog/8/60/mit-mantas-tauchen-vor-machchafushi/fullentry/</a>.</p>
<p><a href="http://blog.go4teams.com/?p=56#">Bookmark on del.icio.us</a><br />
<a href="http://digg.com/submit?phase=2&amp;URL=http://blog.go4teams.com/archives/video-blogging-using-django-and-flashtm-video-flv/56">Add this post to digg.com</a><br />
<a href="http://reddit.com/submit?url=http://blog.go4teams.com/archives/video-blogging-using-django-and-flashtm-video-flv/56&amp;title=Video%20Blogging%20using%20Django%20and%20Flash%28tm%29%20Video%20%28FLV%29">Bookmark on reddit.com</a><br />
<!-- google_ad_section_end --></p>
<div><strong>Posts related to this one:</strong></p>
<ul>
<li><a title="Cited in Bangalore - How cool is that?" rel="bookmark" href="http://blog.go4teams.com/archives/cited-in-bangalore-how-cool-is-that/83">Cited in Bangalore &#8211; How cool is that?</a></li>
<li><a title="Inspiration for a RentaCoder listing" rel="bookmark" href="http://blog.go4teams.com/archives/inspiration-for-a-rentacoder-listing/101">Inspiration for a RentaCoder listing</a></li>
<li><a title="Stealing Blog Content for Fun and Profit" rel="bookmark" href="http://blog.go4teams.com/archives/stealing-blog-content-for-fun-and-profit/79">Stealing Blog Content for Fun and Profit</a></li>
</ul>
</div>
<p>This entry was posted 						  						on Sunday, July 23rd, 2006  						and is filed under <a title="View all posts in Industry" rel="category tag" href="http://blog.go4teams.com/archives/category/industry/">Industry</a>,  <a title="View all posts in trogger.de" rel="category tag" href="http://blog.go4teams.com/archives/category/troggerde/">trogger.de</a>,  <a title="View all posts in Django" rel="category tag" href="http://blog.go4teams.com/archives/category/django/">Django</a>. 						You can follow any responses to this entry through the <a href="http://blog.go4teams.com/archives/video-blogging-using-django-and-flashtm-video-flv/56/feed/">RSS 2.0</a> feed.  						 													You can <a href="http://blog.go4teams.com/?p=56#respond">leave a response</a>, or <a rel="trackback" href="http://blog.go4teams.com/archives/video-blogging-using-django-and-flashtm-video-flv/56/trackback/">trackback</a> from your own site.</div>
</div>
<p><!-- You can start editing here. --></p>
<h3>55 Responses to “Video Blogging using Django and Flash(tm) Video (FLV)”</h3>
<ol class="commentlist">
<li class="alt"> <cite>Nick</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-223">July 23rd, 2006 at 10:08 pm</a><br />
Great tutorial!If I understand correctly, you are doing the reencoding as part of serving the web request, between accepting the submission of the file and finishing the response to the browser? Is it a very long wait, and do you have problems with timeouts, or is ffmpeg fast enough for whatever size of video you’re accepting?</p>
<p>I’ll be especially interested to hear about the details if you ever decide to decouple the processing of the video from the request/response cycle of the web interface, as I’m interested in what sort of help Django provides for starting and interfacing with long(er)-running processes. Actually, I’m curious about how people would do it on any framework <img class="wp-smiley" src="http://blog.go4teams.com/wp-includes/images/smilies/icon_smile.gif" alt=")" /> .</p>
<p>It’s just too bad that doing this reencoding legally in the USA would be difficult and probably requires licenses from countless patent holders <img class="wp-smiley" src="http://blog.go4teams.com/wp-includes/images/smilies/icon_sad.gif" alt="(" /> . (Is that “-acodec mp3″ option to ffmpeg optional, or maybe not actually encoding the audio in MP3? Because I think that the MP3 patent holder demands license fees for use of MP3 encoders. And I suppose the .flv format has a few patents applicable to it too.)</p>
<p>I certainly like mplayer as a video player and have used it to convert audio codecs on the command line before (and imagine video isn’t much harder), and it certainly supports a lot of video codecs (some through use of ffmpeg), but I don’t know which are actually legal to use (some are ripped out of various win32 applications, which might cause legal problems if a website got too much attention; but then again <a rel="nofollow" href="http://ffmpeg.mplayerhq.hu/legal.html">FFMpeg sounds like it has potential problems too</a>, though only of a patent/reverse-engineering nature instead of a copyright/license-agreement nature).</p>
<p>I think you should check out <a rel="nofollow" href="http://pymedia.org/">PyMedia</a> which is a python wrapper for the libraries which are part of ffmpeg. I think it wraps enough to even do the re-encoding directly in python (but maybe a little more slowly than letting C-code handle the file operations in addition to the video re-encoding). <a rel="nofollow" href="http://lists.plone4artists.org/atvideo/archive/2006/2006-01/1138553030516">This discussion</a> mentions some other python libraries for dealing with video, though I’ve never really looked at any of the others.</p>
<p>Anyway, I look forward to future django posts from you!</li>
<li> <cite>Simon</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-236">July 24th, 2006 at 4:37 pm</a><br />
About FFMpeg patents/reverse-engineering problems, they only affect users from countries with barbarian laws such as DMCA (ie the US, Canada and Japan, afaik). FFmpeg is an European product, it is freely developed and hosted there. As long as there is no software patenting in Europe, it’s all good. I guess you’re American, well you can still get it and use it illegally. Of course, if you do it in a corporate environment, you may have some problems. The solution is: call your representatives, take part in the anti-sw patents lobby.</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.go4teams.com/">Daniel Tietze</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-237">July 24th, 2006 at 4:49 pm</a><br />
Simon &#8211; thanks for clearing that up! I was thinking along the same lines. I’m German. So we narrowly escaped process/software patents once, but the issue keeps coming up again and again and again.Everbody interested should check out <a rel="nofollow" href="http://www.nosoftwarepatents.com/">http://www.nosoftwarepatents.com/</a></li>
<li> <cite><a rel="external nofollow" href="http://www.fabianrodriguez.com/">http://www.fabianrodriguez.com</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-238">July 24th, 2006 at 4:53 pm</a><br />
Very interesting. I’d like to suggest you also provide Ogg Theora as a format for inline viewing,perhaps with the Cortado applet viewer from Fluendo. Ogg Theora is free + open format which would make your videos more universally / easily readable.Transcoding from AVI to Ogg Theora is most easy with ffmpeg2theora :<br />
<a rel="nofollow" href="http://www.v2v.cc/%7Ej/ffmpeg2theora/">http://www.v2v.cc/~j/ffmpeg2theora/</a></p>
<p>Extracting metadata from Ogg Theora files may be done with ogginfo in command line.</p>
<p>Many fine resources about Ogg Theora can be found with Google or at <a rel="nofollow" href="http://del.icio.us/search/?all=theora">http://del.icio.us/search/?all=theora</a></li>
<li class="alt"> <cite>Jason Toffaletti</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-239">July 25th, 2006 at 5:34 am</a><br />
Flashticle might be better than flvtool.<a rel="nofollow" href="http://undefined.org/python/#flashticle">http://undefined.org/python/#flashticle</a></p>
<p>If you’re using python2.4 you should the subprocess module instead of commands for security reasons.</p>
<p>Nick asked:<br />
“I’m interested in what sort of help Django provides for starting and interfacing with long(er)-running processes. Actually, I’m curious about how people would do it on any framework”</p>
<p>Twisted[1] is very good for this type of job, it is a framework designed for asynchronous programming. Nevow[2] is a nice web framework that integrates with Twisted. Using Nevow’s Athena you could even report back to the client when the video de/encoding process has completed.</p>
<p>[1] <a rel="nofollow" href="http://twistedmatrix.com/">http://twistedmatrix.com</a><br />
[2] <a rel="nofollow" href="http://divmod.org/trac/wiki/DivmodNevow">http://divmod.org/trac/wiki/DivmodNevow</a></li>
<li> <cite><a rel="external nofollow" href="http://www.go4teams.com/">Daniel Tietze</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-241">July 25th, 2006 at 8:08 am</a><br />
Jason — those are very good tips, thanks a lot! I’ll be sure to check out Twisted, since I have the feeling that I *will* have to move the encoding out of the Web loop for performance reasons (esp. with longer videos).<br />
I’m not too sure what Apache/mod_python does to a Python request which returned a Web page but spawned a subprocess. But I’ll investigate.<br />
The simplest architecture I was envisioning was just calling the conversion process in the background ( “nohup ffmpeg […) &amp;” ), having a reloading view which checks for availability of the file and produces the appropriate response. Not *too* elegant a solution, but I think it could probably be done in quite a robust way.As for Flashticle, I had a look through the Web site but it didn’t tell me what flashticle actually *does*. It says it’s “implementing various Macromedia Flash related data formats and protocols.” and it shows me a spec of the FLV format. But why? And what for? And what can I do with it?</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.t3knoid.com/2006/07/24/video-blogging-using-django-and-flash-video-flv/">t3knoid’s cyberlog » Video Blogging using Django and Flash Video (FLV)</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-244">July 25th, 2006 at 8:33 pm</a><br />
[…] Maybe someday, I’ll have the time to putting a Drupal module together using these methods.read more | digg story –&gt; […]</li>
<li> <cite><a rel="external nofollow" href="http://blog.xsive.co.nz/">Campbell</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-263">July 27th, 2006 at 11:13 am</a><br />
I made Videmo.co.nz …..and using mailenable as an email server you can launch applications on recieving emails…..so you can have a email you mobile videos to your blog.<br />
Take 3gp files in and use FFmpeg to make flvs. I wrapped a c# app to handel the input of data into a database and made a small Ruby on rails site to view it.I also managed to get a lightbox like video pop-up which works ok…but it uncovered a few bugs of the flash player 8. Check out the java script if you want it.</p>
<p>Cheers</p>
<p>Campbell</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://blog.xsive.co.nz/">Campbell</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-264">July 27th, 2006 at 11:14 am</a><br />
P.S. its super slow cause its on a server in my cupboard and on my home connection.</li>
<li> <cite><a rel="external nofollow" href="http://www.micheldumais.com/archives/2006/07/27/un-you-tube-100-opensource/">Un “You Tube” 100% OpenSource — Ouvert 24 heures &#8211; Verres stérilisés Archive</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-265">July 27th, 2006 at 6:12 pm</a><br />
[…] La recette demande un peu de bidouillage, mais le résultat est plus qu’intéressant. Sûrement que le tout s’adapte à d’autres CMS et outils de blogue. Via Flashinsider […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://luar.com.hk/blog/?p=670">Yet Another Blog from Luar » FFmpeg usage command</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-267">July 28th, 2006 at 4:59 am</a><br />
[…] Video Blogging using Django and Flash(tm) Video (FLV)      […]</li>
<li> <cite><a rel="external nofollow" href="http://elearningskinny.com/shall-we-roll-our-own-youtube-for-barcamp-vancouver/">eLearning Skinny » Blog Archive » Shall We Roll Our Own YouTube for BarCamp Vancouver?</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-270">July 28th, 2006 at 1:03 pm</a><br />
[…] I pointed to this ‘roll your own open source YouTube’ post from Flash Insider (a summary of this original concept from Daniel’s Random Mutterings). […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.dotpod.com.ar/2006/07/28/c2bfcomo-crear-tu-propio-youtube/">Dotpod — ¿Cómo crear tu propio YouTube?</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-273">July 28th, 2006 at 6:26 pm</a><br />
[…] Un post reciente en el Blog Daniel’s Random Mutterings explica detalladamente cómo hacerlo. Mediante herramientas Open Source como el Djano CMS System, FFMpeg para la conversión en FLV, el FLVtools2 para escribir la información META y el FlowPlayer para embeber el swf, tendrás todo para comenzar a hacerlo. […]</li>
<li> <cite><a rel="external nofollow" href="http://www.kersten.com.ar/blog/crea-tu-propio-youtube/">Eric Kersten Weblog » Blog Archive » Crea tu propio YouTube</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-283">July 30th, 2006 at 4:34 am</a><br />
[…] El link aca: <a rel="nofollow" href="http://blog.go4teams.com/?p=56">http://blog.go4teams.com/?<strong>p=56</strong></a> […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.rooftopsolutions.nl/article/89">Evert</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-296">July 31st, 2006 at 4:41 pm</a><br />
FFMpeg now supports FLV 1.1, so you don’t need the FLVTool2 part anymore.. I wrote a small entry about this</li>
<li> <cite><a rel="external nofollow" href="http://www.felipeandrade.org/blog/?p=62">felipeandrade.org » “You tube” 100% Open Source</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-297">July 31st, 2006 at 5:45 pm</a><br />
[…] Você pode encontrar mais detalhes no link abaixo: <a rel="nofollow" href="http://blog.go4teams.com/?p=56">http://blog.go4teams.com/?<strong>p=56</strong></a> […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://blog.fack.org/2006/07/24/video-blogging-using-django-and-flash-video-flv/">EveryDigg » Blog Archive » Video Blogging using Django and Flash Video (FLV)</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-311">August 3rd, 2006 at 6:06 pm</a><br />
[…] &#8220;The whole process is surprisingly simple and straightforward and can be done entirely with free (FLOSS) tools.&#8221; A pretty straighforward guide. read more | digg story […]</li>
<li> <cite><a rel="external nofollow" href="http://www.nooree.com/blog/?p=7">nooree style » Blog Archive » How to create your own YouTube site</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-318">August 5th, 2006 at 12:54 am</a><br />
[…] Have you ever wanted to know how you can create your own video hosting site allowing users to upload video, utomatically convert it to FLV, and display it for the world to see? A recent post at Daniel’s Random Mutterings (DRM &#8211; how clever) explains exactly how to do this with open source tools. […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.cinevivo.com.ar/">Sebastian</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-325">August 5th, 2006 at 7:49 am</a><br />
Hola a todos, viendo que estan utilizando tecnologia flv para video, pueden visitar esta web que usamos esa tecnologia y tienen un js a mano para descargar.</li>
<li> <cite><a rel="external nofollow" href="http://www.blogmemes.net/meme/12011">www.blogmemes.net</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-703">August 19th, 2006 at 7:32 am</a><br />
<strong>Your own youtube like hosting service ?</strong>Liked what you just read here ? Vote for it on Blogmemes ! The whole process of adding Flash-based (FLV) video blogging support is surprisingly simple and straightforward and can be done entirely with free (FLOSS) tools.</li>
<li class="alt"> <cite>Jimleouf</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-775">August 22nd, 2006 at 2:43 pm</a><br />
Hi there,<br />
I just start with Django and i’m still not familiar with it.<br />
I tried to follow the guide but I still got errors, if one of you who successe to deploy this have some time, i’ll appreciate the help.<br />
jimleouf_at_gmail.com<br />
ThanksJimleouf</li>
<li> <cite>franky</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-827">August 24th, 2006 at 7:52 am</a><br />
i tried your flv conversion setting, but video quality is not so good when compared with “flash 8 video encoder”..<br />
is there any settings that can improve the video quality?i have “-b 1000 -ar 44100 -ab 64 -s 750×600″</p>
<p>thanks</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.tunaspecial.com/?p=162">spam: the other white meat » A Drupal youtube Site Recipe</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-1610">September 12th, 2006 at 4:06 am</a><br />
[…] Video Blogging using Django and Flash(tm) Video (FLV) […]</li>
<li> <cite><a rel="external nofollow" href="http://www.allindustrynews.org/business-technology/video-blogging-using-django-and-flash-video-flv/">Tech Industry » Video Blogging using Django and Flash Video (FLV)</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-1664">September 13th, 2006 at 10:52 am</a><br />
[…] “The whole process is surprisingly simple and straightforward and can be done entirely with free (FLOSS) tools.” A pretty straighforward guide. read more | digg story […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://flixn.com/">Samuel J. Greear</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-2462">September 25th, 2006 at 9:14 pm</a><br />
Great writeup. From experience doing this sort of thing mplayer/mencoder will do a better job on the multiple formats front if you take enough time to sift through and find the proper command line options. It is a wrapper around ffmpeg and others. AFAIK ffmpeg still does not support the newest WMV formats, mencoder can handle them.On a similar front we have recently rolled out a tool to facilitate instant video blogging from a webcam, and would be honored if you would check it out. <a rel="nofollow" href="http://flixn.com/">http://flixn.com/</a> .. and <a rel="nofollow" href="http://flixn.com/developers/">http://flixn.com/developers/</a></li>
<li> <cite><a rel="external nofollow" href="http://www.go4teams.com/">Daniel Tietze</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-2463">September 25th, 2006 at 9:22 pm</a><br />
I had a quick look at flixn.com — The start page greets me with the need to have the “latest Flash plugin” and not very much else.<br />
As a Linux/Firefox user that’s pretty much a deal-killer right there.</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://flixn.com/">Samuel J. Greear</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-2465">September 25th, 2006 at 9:30 pm</a><br />
Daniel, as a (primarily) BSD/Firefox user, I feel your pain. I’m actually hacking away at the templates right now as it has become painfully obvious that the “not much else” is a problem. As to flash, fortunately Flash9 for Linux appears to be looming near.</li>
<li> <cite>Tim</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-2547">September 27th, 2006 at 10:10 am</a><br />
Great stuff!!<br />
This tutorial is just awesome! I was just wondering, will you get it updated with the comments/suggestions as to what command line is best to use, and so on…?Also, flixn is great <img class="wp-smiley" src="http://blog.go4teams.com/wp-includes/images/smilies/icon_smile.gif" alt="-)" /></li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.go4teams.com/">Daniel Tietze</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-2558">September 27th, 2006 at 3:15 pm</a><br />
We have a long weekend coming up in Germany. I’ll maybe try and get something updated.</li>
<li> <cite><a rel="external nofollow" href="http://www.myspace.com/HeadBangingKitty">Colin Esbensen</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-2699">October 1st, 2006 at 4:21 am</a><br />
Hey Daniel,I’m trying to get the Flow Player to work on myspace. I just hate the ads for youtube and so on. Plus I want to be able to control the quality of the product. I’ve been at this for a week now and have gotten no where. I hit the wall and I’d have pulled out all my hair by now if I had any. : ) I wouldn’t ask if I wasn’t at my wits end, but could you help me.</p>
<p>Cheers, Colin</li>
<li class="alt"> <cite>gumango</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-3303">October 19th, 2006 at 9:03 am</a><br />
To convert any file format you can use mencoder rather than ffmpeg. But with mencoder we have problem with 3gp files audio. Mainly because of the AMR codec support issue. But you can use mencoder for most of the video formats and only for 3gp you can use ffmpeg.</li>
<li> <cite>Pradeep B V</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-6299">December 2nd, 2006 at 9:53 pm</a><br />
Hey Daniel,I have used parts of your post for my presentation at BarCampBangalore.</p>
<p>Thanks a ton.</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://forums.macnn.com/88/web-developer/319841/creating-a-you-tube-streaming/#post3233220">creating a You tube or streaming server &#8211; MacNN Forums</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-6786">December 8th, 2006 at 3:42 pm</a><br />
[…] Link dump Using Lighttpd, Mplayer/Mencoder and Flvtool2 to Implement Flash Video Streaming :: Homo-Adminus Blog by Alexey Kovyrin Video Blogging using Django and Flash(tm) Video (FLV) » DRM &#8211; Daniel’s Random Mutterings digg &#8211; How to create your own Youtube and get your own billion Eh some i found. I looked for Rails version since I am versed n Rails now instead of python but if you have any leads they would be much appreciated. […]</li>
<li> <cite><a rel="external nofollow" href="http://zappa.tvu.ac.uk/%7E02menzingerd/netart/?p=114">Internet and Network Art » FFMPEG</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-7154">December 9th, 2006 at 9:30 pm</a><br />
[…] <a rel="nofollow" href="http://www.jessewarden.com/archives/2006/09/serverside_ffmpeg.html">http://www.jessewarden.com/archives/2006/09/serverside_ffmpeg.html</a> […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.tutorials.de/forum/php/263278-video-konvertierung-mittels-php-apache-wie-youtube.html#post1365039">Video konvertierung mittels php &amp; apache wie in youtube &#8211; PHP @ tutorials.de: Forum &#8211; Tutorials &#8211; Hilfe &#8211; Schulung &amp; mehr</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-17978">January 10th, 2007 at 11:31 pm</a><br />
[…] AW: Video konvertierung mittels php &amp; apache wie in youtube     Hey,  siehe hier: <a rel="nofollow" href="http://blog.go4teams.com/?p=56">http://blog.go4teams.com/?<strong>p=56</strong></a> In dem Artikel wird zwar die Benutzung von Django beschrieben, lässt sich aber auch Ruby bzw. RubyonRails übertragen. Mit PHP ist die Lösung nicht und ich denke auch nicht, dass es irgendwelche Lösungen geben wird mittels PHP und anderen Tools Videos in FLV umzuwandeln. Zitat: […]</li>
<li> <cite><a rel="external nofollow" href="http://www.mcdave.net/post/486">mcdave.net » links for 2007-01-20</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-19509">January 24th, 2007 at 2:14 pm</a><br />
[…] Video Blogging using Django and Flash(tm) Video (FLV) » DRM &#8211; Daniel’s Random Mutterings (tags: video flash django tutorial python flv) […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.digital-motion.net/2007/01/30/some-flashy-goodness-for-your-tuesday-morning/">Digital Motion dot net » Some flashy goodness for your Tuesday morning</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-20001">January 30th, 2007 at 3:45 pm</a><br />
[…] Finally, Daniel Tietze tell you how to make your own uTube.      –&gt; […]</li>
<li> <cite><a rel="external nofollow" href="http://scaracco.wordpress.com/2007/03/10/realizzare-un-clone-di-youtube/">Realizzare un Clone di YouTube « Scaracco</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-23131">March 10th, 2007 at 12:46 pm</a><br />
[…] Ispirazione: Video Blogging using Django and Flash(tm) Video (FLV) […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.flv-converter.com/">FLV converter</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-23523">March 16th, 2007 at 2:08 pm</a><br />
[…] Finally, FLV converter tell you how to make your own uTube. –&gt; […]</li>
<li> <cite><a rel="external nofollow" href="http://www.flv-converter.com/">FLV converter</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-23524">March 16th, 2007 at 2:18 pm</a><br />
Great Post, now it would be nice to convert some WMV files that are conflictive to get absolutely transparent to the user, any ideas?Greets…</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.flv-converter.com/">FLV converter</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-23525">March 16th, 2007 at 2:29 pm</a><br />
FFMpeg now supports FLV 1.1, so you don’t need the FLVTool2 part anymore.. I wrote a small entry about this . AS far AS I know, it may has update to 1.2</li>
<li> <cite>Jack</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-24843">March 30th, 2007 at 2:48 pm</a><br />
Hi Daniel,I met a problem when I was trying to use your code. I put Flowplayer and my video in the same folder. I can load Flowplayer but can’t load the video file. So there is always a blank screen. I am using Ubuntu+Apache2. Already did the housekeeping stuff. I am a newbie and searched google, so you are the last man I can ask. Thanks!</li>
<li class="alt"> <cite>David Lavoie</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-26716">April 18th, 2007 at 8:23 pm</a><br />
I had an issue using FFMPEG with linux.<br />
Basically on errors, i would get a constant stream of errors in my apache log files, filling the hard drive (up to like 60gigs or repeated errors).Anyone else have this issue? ever?<br />
Any idea how to ensure that the output of FFMPEG run by PHP could be redirected to /dev/null or somthing?</li>
<li> <cite><a rel="external nofollow" href="http://www.zalapao.info/?p=15">Zalapao Press » Blog Archive » FFmpeg usage command</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-33177">June 5th, 2007 at 11:00 am</a><br />
[…] Video Blogging using Django and Flash(tm) Video (FLV) […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://portal.xchan.ath.cx/video/">iGloo</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-35515">June 21st, 2007 at 4:03 am</a><br />
Hi there.You should try mencoder wich use FFMPEG for some part of the conversion, the only thing is MEncoder quality will be much higher than FFMPEG alone.</p>
<p>As for the video conversion, i spawn a SH script in the background to do the work. I wrote a upload handler script in both perl and php.</p>
<p>To get WMV/MPEG/etc conversion, go to Mencoder website and get the essential codec pack. It is a collection of freely available binaries Mencoder can use to encode/read.</p>
<p>Here the revelant mencoder part:</p>
<p>#!/bin/sh<br />
nice /usr/local/bin/mencoder -o .flv -of lavf -ovc lavc -oac lavc -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames<br />
-lavcopts vcodec=flv:autoaspect:vbitrate=350:v4mv:vmax_b_frames=0:vb_strategy=1:mbd=2:mv0:trell:cbp:sc_factor=6:cmp=2:subcmp=2:predia=2:dia=2:preme=2:turbo:acodec=mp3:abitrate=56<br />
-vf scale=320:240 -srate 22050 -af lavcresample=22050</p>
<p>/usr/local/bin/flvtool2 -U .flv</li>
<li> <cite>pat</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-36086">June 27th, 2007 at 11:07 pm</a><br />
how the heck am i supposed to comprehend this crap!! make it for 2 year olds to understand and then we will get somewhere! ok thank you</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://paxoblog.wordpress.com/2007/07/06/links-for-2007-07-06/">links for 2007-07-06 « PaxoBlog</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-37171">July 10th, 2007 at 4:05 pm</a><br />
[…] Video Blogging using Django and Flash(tm) Video (FLV) » DRM &#8211; Daniel’s Random Mutterings I just added Flash-based (FLV) video blogging support to my Django-powered travel portal site, trogger.de. The whole process is surprisingly simple and straightforward and can be done entirely with free (FLOSS) tools. (tags: django video blog theory overview flash youtube related) […]</li>
<li> <cite><a rel="external nofollow" href="http://tokafi.com/">Michael</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-37294">July 11th, 2007 at 7:42 pm</a><br />
Thanks for this!Worked really great (only getting ffmpeg to work with mp3 was a little bit tricky on my debian system. In the end I just recompiled ffmpeg from source.. see here <a rel="nofollow" href="http://blog.gwikzone.org/articles/2006/09/25/flv-encoding-with-ffmpeg">http://blog.gwikzone.org/articles/2006/09/25/flv-encoding-with-ffmpeg</a> also the option changed and copied manually libmp3lame.so.0 to the right location)</p>
<p>I really start to like django…</li>
<li class="alt"> <cite>Alce</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-38691">July 23rd, 2007 at 3:26 am</a><br />
Awesome post (and comments). Although I am not familiar with Django, the process you posted here fits perfectly with what I am trying to achieve, regardless of language or framework. You just saved me some 6+ hours of browsing to gather all the info I needed. Thanks a bunch.</li>
<li> <cite>HenrikG</cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-39722">August 3rd, 2007 at 2:59 pm</a><br />
I had some problems getting ffmpeg to work with mp3 encoding on Ubuntu Linux. First configuration:<br />
./configure –enable-gpl –enable-pp –enable-libfaad –enable-libvorbis –enable-libogg –enable-liba52 –enable-dc1394 –enable-libgsm –enable-libmp3lame –enable-libfaac –enable-libxvid –enable-pthreads –enable-libx264The problem occured when I compiled ffmpeg with “make”:</p>
<p>Imlib2.h:108: error: syntax error before “*” token</p>
<p>I solved this by installing Imlib2 from source:<br />
href=”http://sourceforge.net/project/showfiles.php?group_id=2<br />
(check at the bottom of the page)</p>
<p>I also installed a lot of libs to get the compilation to work:</p>
<p>apt-get build-dep ffmpeg<br />
apt-get install liblame0 liblame-dev libtool libpng3 libpng3-dev libttf-dev cdbs libbz2-dev libid3tag0 libid3tag0-dev xlibs-dev libxvidcore4-dev libx264-dev libfaac-dev libfaad2-dev</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://zonacerebral.com/2007/07/como-crear-tu-propio-youtube-y-ganar-dinero-en-internet-anadiendo-video-ads.html">Plantillas para Blogger, recursos y herramientas » Como crear tu propio Youtube y ganar dinero en internet añadiendo Video Ads.</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-52411">November 18th, 2007 at 7:39 pm</a><br />
[…] En el blog Daniel’s Random Mutterings se explica paso a paso cómo montar un servicio de alojamiento, gestión y reproducción que permita a los usuarios subir y compartir sus vídeos con el resto de internautas. El proceso no es muy complicado a pesar de que no había oído hablar nunca de las herramientas mencionadas en el artículo, como por ejemplo el CMS Django, pero desde mi punto de vista el resultado final tiene un valor más bien pobre en cuanto a su personalización y diseño al gestionarse a través del portal gratuito Trogger.de. También es necesario contar con una herramienta para convertir los archivos al formato FLV (FFMpeg), la utilidad FLVtools2 para añadir la meta información y el reproductor Flowplayer para incrustar los archivos SWF de flash. […]</li>
<li> <cite><a rel="external nofollow" href="http://www.typo3forum.net/forum/typo3-4-x-fragen-und-probleme/24860-video-blog-mit-typo3.html#post80047">Video Blog mit TYPO3? &#8211; TYPO3forum.net</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-52781">November 20th, 2007 at 12:31 pm</a><br />
[…] permalink Hallo allerseits, Ich sehe mir gerade Blog Extensions von TYPO3 an. Ziel wäre eine Art Video Blog a la YouTube. Im TER finden sich ja timtab, timtab_embeddedvideo. Einige interessante Extensions wären auch bddb_flvvideogallery, flvplayer. Es gäbe ja einige OpenSource Tools für Flash Video: FFMpeg (für Video Umkodierung von MPEG,AVI,Quicktime, etc FLV) FLVtools2, mplayer, etc (für Video Metadaten) Beim Recherchieren bin ich noch auf einen Artikel gestoßen: Video Blogging using Django and Flash(tm) Video (FLV) Was haltet ihr vom Thema Video Blog mit TYPO3? […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://www.tobyflux.com/?p=32">How to create your own YouTube site</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-55626">December 14th, 2007 at 6:38 pm</a><br />
[…] A recent post at Daniel’s Random Mutterings explains how to do this with open source tools. Filed Under Design &amp; development […]</li>
<li> <cite><a rel="external nofollow" href="http://www.go2log.com/blog/?p=95">FFmpeg usage command | Gone with the wind</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-59697">January 28th, 2008 at 3:25 pm</a><br />
[…] Video Blogging using Django and Flash(tm) Video (FLV) […]</li>
<li class="alt"> <cite><a rel="external nofollow" href="http://aich.aiistudentwork.com/students/kristinasanders/capstone/?p=5">Proposal &#8211; Video Blogger for Cat Facts! » PAWSit</a></cite> Says:<br />
<a href="http://blog.go4teams.com/?p=56#comment-61885">February 14th, 2008 at 10:11 pm</a><br />
[…] Create Your Own YouTube […]</li>
</ol>
<h3>Leave a Reply</h3>
<p>Name (required)</p>
<p>Mail (will not be published) (required)</p>
<p>Website<br />
&lt;!&#8211;<br />
<strong>XHTML:</strong> You can use these tags: &lt;a href=&#8221;" title=&#8221;"&gt; &lt;abbr title=&#8221;"&gt; &lt;acronym title=&#8221;"&gt; &lt;b&gt; &lt;blockquote cite=&#8221;"&gt; &lt;code&gt; &lt;em&gt; &lt;i&gt; &lt;strike&gt; &lt;strong&gt;<br />
&#8211;&gt;</div>
<hr />
<div id="footer">DRM &#8211; Daniel’s Random Mutterings &#8212; powered by <a href="http://wordpress.org/">WordPress</a><br />
<a href="feed://http//blog.go4teams.com/feed/">Entries (RSS)</a> and <a href="feed://http//blog.go4teams.com/comments/feed/">Comments (RSS)</a>. 		<!-- 27 queries. 0.753 seconds. --></div>
</div>
<p><!-- Gorgeous design by Michael Heilemann - http://binarybonsai.com/kubrick/ --></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://onlydarksets.com/2009/01/29/roll-your-own-youtube-mirror/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ffmpeg: &#8220;trell&#8221; errors</title>
		<link>http://onlydarksets.com/2008/09/24/ffmpeg-trell-errors/</link>
		<comments>http://onlydarksets.com/2008/09/24/ffmpeg-trell-errors/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 01:24:57 +0000</pubDate>
		<dc:creator>onlydarksets</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[ffmpeg]]></category>

		<guid isPermaLink="false">http://onlydarksets.wordpress.com/?p=453</guid>
		<description><![CDATA[I&#8217;ve found a few command lines to use ffmpeg to convert to iPod format, and they almost all use the &#8220;trell&#8221; flag.  I kept getting errors, and then I found that it is no longer a valid flag, so it needs to be removed from the command line. And what is &#8220;trell&#8221;?  Not sure &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve found a few command lines to use ffmpeg to convert to iPod format, and they almost all use the &#8220;trell&#8221; flag.  I kept getting errors, and then I found that <a href="http://article.gmane.org/gmane.comp.video.ffmpeg.user/18449" target="_blank">it is no longer a valid flag</a>, so it needs to be removed from the command line.</p>
<p>And what is &#8220;trell&#8221;?  Not sure &#8211; <a href="http://www.transcoding.org/cgi-bin/transcode?Export_Modules/Export_Ffmpeg" target="_blank">something to do with</a> <a href="http://en.wikipedia.org/wiki/Quantization_(image_processing)" target="_blank">quantization</a>:</p>
<blockquote><p><span style="color:brown;">trell</span> trellis quantization<br />
this will find the optimal encoding for each 8&#215;8 block<br />
trellis quantization is quite simple a optimal quantization in the PSNR vs bitrate sense (assuming that there would be no rounding errors introduced by the IDCT, which is obviously not the case) it simply finds a block for the minimum of error + lambda*bits<br />
lambda is a qp dependant constant<br />
bits is the amount of bits needed to encode the block<br />
error is simple the sum of squared errors of the quantization</p></blockquote>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://onlydarksets.com/2008/09/24/ffmpeg-trell-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert Sage recordings to iPhone</title>
		<link>http://onlydarksets.com/2008/09/19/convert-sage-recordings-to-iphone/</link>
		<comments>http://onlydarksets.com/2008/09/19/convert-sage-recordings-to-iphone/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 15:21:22 +0000</pubDate>
		<dc:creator>onlydarksets</dc:creator>
				<category><![CDATA[DVRMSToolbox]]></category>
		<category><![CDATA[Music/Video Players]]></category>
		<category><![CDATA[SageTV]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[babgvant]]></category>
		<category><![CDATA[ffmpeg]]></category>

		<guid isPermaLink="false">http://onlydarksets.wordpress.com/?p=408</guid>
		<description><![CDATA[I have posted an updated method.  I STRONGLY SUGGEST YOU USE IT INSTEAD!  I leave the below for posterity&#8230;   NOTE: mencoder is not cutting commercials properly on my system.  Everything else is working fine.  I&#8217;ll post an update when I get it working. Here is how I&#8217;m converting SageTV recordings to iPhone-compatible (and Touch/iPod-compatible) [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://onlydarksets.com/2009/01/02/converting-sagetv-recordings-to-zuneipodiphone-version-20/"><strong>I have posted an updated method</strong></a><strong>.  I STRONGLY SUGGEST YOU USE IT INSTEAD!  I leave the below for posterity&#8230;</strong></p>
<p> </p>
<p><em><strong>NOTE</strong>: mencoder is not cutting commercials properly on my system.  Everything else is working fine.  I&#8217;ll post an update when I get it working.</em></p>
<p>Here is how I&#8217;m converting SageTV recordings to iPhone-compatible (and Touch/iPod-compatible) MP4 videos.  <span style="text-decoration:underline;"><strong>This will also work for the Zune!</strong></span></p>
<p>At a high level, the steps (and applications used) are:</p>
<ol>
<li><a href="http://www.babgvant.com/" target="_blank">DVRMSToolbox</a>: monitor the recordings directories, identify which shows to process, grab the metadata that is later written to the MP4, and control program flow</li>
<li><a href="http://www.kaashoek.com/comskip/" target="_blank">comskip</a> or <a href="http://www.dragonglobal.biz/showanalyzer.html" target="_blank">ShowAnalyzer</a>: Scan for commercials</li>
<li><a href="http://www.mplayerhq.hu/" target="_blank">mencoder</a>: Cut commercials</li>
<li><a href="http://babgvant.com/files/folders/misc/entry4997.aspx" target="_blank">ffmpeg</a>: Convert to MP4 (<em>note: I had problems with <a href="http://tripp.arrozcru.org/" target="_self">the latest Windows build of ffmpeg</a>, but <a href="http://babgvant.com/files/folders/misc/entry4997.aspx">the one from babgvant.com</a> worked fine</em>)
<ol>
<li>Option 2 is to use mencoder to cut out commercials and convert to MP4 in single pass, and then use <a href="http://nic.dnsalias.com/" target="_blank">NicMP4Box</a> to fix the MP4 container to make it iPod-compatible
<ul>
<li><em>Apparently mencoder&#8217;s <a href="http://mulder.dummwiedeutsch.de/home/?page=projects" target="_blank">current implementation</a> (2008-09-17) of lavf <a href="http://lists.mplayerhq.hu/pipermail/mencoder-users/2007-December/007696.html" target="_blank">correctly handles the MP4 container</a>, but I haven&#8217;t verified this.  If true, you can skip this step.</em></li>
<li><em>Also (apparently), <a href="http://rob.opendot.cl/index.php/useful-stuff/ipod-video-guide/" target="_blank">the latest SVN of AtomicParsley can fix this</a>, but you have to build it yourself.<br />
</em></li>
</ul>
</li>
</ol>
</li>
<li><a href="http://atomicparsley.sourceforge.net/" target="_blank">AtomicParsley</a>: Write metadata to identify as TV Shows (plus any other info we have)</li>
</ol>
<p>I am assuming basic familiarity with DTb, so I&#8217;ll talk about how to setup the Profile to process a Sage recording, but I am not addressing installing DTb or setting up the processing condition.</p>
<p>More after the break&#8230;</p>
<p><span id="more-408"></span></p>
<h3>DTb: Setup the Profiles</h3>
<p><em>Note you will need to create one profile for SD and one for HD.  The only difference will be profile indicated in the the call to mencoder/ffmpeg (step 6).</em></p>
<ol>
<li>Throttle to prevent unlimited workers from running</li>
<li>Set a timeout (trust me &#8211; the first time mencoder hangs and you don&#8217;t have &#8220;Lost&#8221; waiting for you in the morning like you were expecting, you&#8217;ll be glad)</li>
<li>Update OutputFile context to allow for MP4 extension:<br />
FIND IN OutputFile: ^((.*\)(.*).(.*))z<br />
REPLACE IN OutputFile: $2$3.mp4</li>
<li>Create a new context to specify the Sage commercial file location:<br />
FIND IN InputFile: ^((.*\)(.*).(.*))z<br />
REPLACE IN SageEDLFile: $2$3.edl</li>
<li>Find commercials</li>
<li><strong>Option 1 &#8211; ffmpeg<br />
</strong><em>Note: this process is tried and true, but you suffer a performance hit since mencoder has to rewrite the entire file to cut the commercials.</em> </p>
<ol>
<li>Cut commercials with mencoder<br />
mencoder &#8220;%InputFile%&#8221; -edl &#8220;%SageEDLFile%&#8221; -oac copy -ovc copy -of mpeg -o &#8220;%OutputFile%.mpg&#8221;</li>
<li>Convert with ffmpeg<br />
Profile: X264 with AAC</li>
</ol>
</li>
<li><strong>Option 2 &#8211; mencoder<br />
</strong><em>Note: mencoder does not have the best implementation of the mp4 container, and I have had problems getting the conversion to work properly.  However, if you can get it to work, the overall process is faster)</em> </p>
<ol>
<li>Cut and convert with mencoder<br />
mencoder &#8220;%InputFile%&#8221; -edl &#8220;%SageEDLFile%&#8221; -profile x264IPod-SD -o &#8220;%OutputFile%.tmp.mp4&#8243;</li>
<li>Remux MP4 with NicMP4Box<br />
NicMP4Box -add &#8220;%OutputFile%.TMP.mp4&#8243; &#8220;%OutputFile%&#8221;</li>
</ol>
</li>
<li>Add basic metadata to MP4:<br />
AtomicParsley &#8220;%OutputFile%&#8221; &#8211;genre &#8220;TV Shows&#8221; &#8211;stik &#8220;TV Show&#8221; &#8211;TVNetwork %channelName% &#8211;TVShowName &#8220;%Title%&#8221; &#8211;TVEpisode &#8220;%episode%&#8221; &#8211;description &#8220;%description%&#8221; &#8211;category=&#8221;%category%&#8221;</li>
<li>Rename the output file to something meaningful:<br />
CONTEXT: OutputFile<br />
PATTERN: %Title% &#8211; %<span class="t">originalAirDate</span>% &#8211; %episode%</li>
</ol>
<h3>Setup the Profiles</h3>
<p>I use two profiles, one for HD sources and one for SD.  I resize to 640&#215;480 or 640&#215;360, since that&#8217;s the max resolution the iPhone can handle (Zune can handle 720&#215;480).</p>
<p>A couple of other notes:</p>
<ul>
<li>You must use H.264 or MPEG-4 with AAC audio &#8211; the iPhone supports nothing else.</li>
<li>You can mess with the bitrates (<strong>bitrate=x</strong>), but keep in mind the bitrate maximums (<strong>vbv_maxrate=x</strong>) that the iPhone supports (currently 1500).</li>
<li>The maximum IDC is currently 30 (<strong>level_idc=30</strong>)</li>
<li>Cabac is not supported (<strong>nocabac</strong>)</li>
</ul>
<h4>Option 1: ffmpeg</h4>
<p>Here&#8217;s the ffmpeg profile that&#8217;s working for me right now (note the &#8220;-ac 2&#8243; parameter for the audio encoding &#8211; this was the only way I could get the sound to play on the iPhone):</p>
<p>&lt;profile&gt;<br />
&lt;name&gt;MPEG-4 with AAC HD&lt;/name&gt;<br />
&lt;description&gt;MPEG-4 with AAC HD (iPhone-compatible Archive)&lt;/description&gt;<br />
&lt;extension&gt;mp4&lt;/extension&gt;<br />
&lt;video&gt;-vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2&lt;/video&gt;<br />
&lt;audio&gt;-acodec libfaac -ac 2 -ab 128000&lt;/audio&gt;<br />
&lt;/profile&gt;</p>
<p>Here are some other command lines that I&#8217;ve found, mostly from <a href="http://babgvant.com/forums/t/990.aspx?PageIndex=1" target="_blank">here</a>, in case you want to tinker:</p>
<ul>
<li>ffmpeg -y -benchmark -threads 2 -i &#8220;input.dvr-ms&#8221; -async 1 -deinterlace -s qvga -vcodec libx264 -b 384000 -bufsize 384 -coder 0 -level 13 -acodec libfaac &#8220;output.mp4&#8243;</li>
<li>4:3 and 16:9:
<ul>
<li>ffmpeg -y -benchmark -threads 2 -i &#8220;%CutDvrmsFile%&#8221; -async 1 -deinterlace -croptop 0 -cropbottom 4 -cropleft 8 -cropright 6 -s 704:480 -vcodec libx264 -b 832k -maxrate 960k -bufsize 384k -coder 1 -level 13  -flags +loop -cmp +chroma -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -flags2 +wpred+mixed_refs+8x8dct+brdo -me umh -trellis 2 -bidir_refine 1 -refs 3 -b_strategy 1 -directpred 2 -subq 5 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -aspect 4:3 -acodec libfaac -ab 128k &#8220;%OutputFile%&#8221;</li>
<li>ffmpeg -y -benchmark -threads 2 -i &#8220;%CutDvrmsFile%&#8221; -async 1 -deinterlace -croptop 56 -cropbottom 60 -cropleft 8 -cropright 6 -s 704:368 -vcodec libx264 -b 832k -maxrate 960k -bufsize 384k -coder 1 -level 13  -flags +loop -cmp +chroma -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -flags2 +wpred+mixed_refs+8x8dct+brdo -me umh -trellis 2 -bidir_refine 1 -refs 3 -b_strategy 1 -directpred 2 -subq 5 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -aspect 16:9 -acodec libfaac -ab 128k &#8220;%OutputFile%&#8221;</li>
</ul>
</li>
<li>ffmpeg -i <span style="color:#ff0000;"><em><strong>input</strong></em></span> -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -s 640&#215;360 -title <span style="color:#ff0000;"><strong>X</strong></span> <span style="color:#ff0000;"><strong>output</strong></span>.mp4<br />
(from <a href="http://http://ffmpeg.mplayerhq.hu/faq.html#SEC25" target="_blank">http://ffmpeg.mplayerhq.hu/faq.html#SEC25</a>)</li>
</ul>
<h4>Option 2: mencoder</h4>
<blockquote><p>[x264IPod-SD]<br />
profile-desc=&#8221;H.264/AAC MP4 SD for iPhone &#8211;After this, use NicMP4Box to remux&#8211;&#8221;<br />
lavdopts=threads=2<br />
vf=pp=md,scale=640:-10,harddup<br />
ovc=x264=yes<br />
x264encopts=turbo=1:bitrate=768:vbv_maxrate=1500:vbv_bufsize=244:nocabac:level_idc=30:threads=2<br />
oac=faac=yes<br />
faacopts=br=128:object=2:mpeg=4:raw=yes<br />
of=lavf=yes<br />
lavfopts=format=mp4<br />
#DtbExtension=mp4<br />
#dtbhres=&#8221;-vf pp=md,scale={0}:-10,harddup&#8221;</p></blockquote>
<blockquote><p>[x264IPod-HD]<br />
profile-desc=&#8221;H.264/AAC MP4 SD for iPhone &#8211;After this, use NicMP4Box to remux&#8211;&#8221;<br />
lavdopts=threads=2<br />
vf=pp=md,scale=640:-10,harddup<br />
ovc=x264=yes<br />
x264encopts=turbo=1:bitrate=1200:vbv_maxrate=1500:vbv_bufsize=244:nocabac:level_idc=30:threads=2<br />
oac=faac=yes<br />
faacopts=br=128:object=2:mpeg=4:raw=yes<br />
of=lavf=yes<br />
lavfopts=format=mp4<br />
#DtbExtension=mp4<br />
#dtbhres=&#8221;-vf pp=md,scale={0}:-10,harddup&#8221;</p></blockquote>
<h3>Resources:</h3>
<ul>
<li><a href="http://lists.mplayerhq.hu/pipermail/mencoder-users/2007-December/007692.html" target="_blank">http://lists.mplayerhq.hu/pipermail/mencoder-users/2007-December/007692.html</a></li>
<li><a href="http://rob.opendot.cl/index.php/useful-stuff/ipod-video-guide/" target="_blank">http://rob.opendot.cl/index.php/useful-stuff/ipod-video-guide/</a></li>
<li>Getting mencoder to cut commercials with muxing errors:
<ul>
<li><a href="http://forum.videohelp.com/topic346473.html" target="_blank">http://forum.videohelp.com/topic346473.html</a></li>
<li><a href="http://readlist.com/lists/mplayerhq.hu/mencoder-users/0/3146.html" target="_blank">http://readlist.com/lists/mplayerhq.hu/mencoder-users/0/3146.html</a></li>
<li><a href="http://lists.mplayerhq.hu/pipermail/mencoder-users/2006-June/003369.html" target="_blank">Increase muxrate to 36000</a></li>
<li><a href="http://www.tivocommunity.com/tivo-vb/showthread.php?p=6776831" target="_blank">-noskip option</a></li>
</ul>
</li>
</ul>
<h3>Related posts:</h3>
<ul>
<li><a href="http://onlydarksets.com/2008/09/16/transcoding-in-sage/">http://onlydarksets.com/2008/09/16/transcoding-in-sage/</a></li>
<li><a href="http://onlydarksets.com/2008/07/06/mp4-tagging/">http://onlydarksets.com/2008/07/06/mp4-tagging/</a></li>
<li><a href="http://onlydarksets.com/2008/06/13/convert-for-iphone-using-mencoderffmpeg/">http://onlydarksets.com/2008/06/13/convert-for-iphone-using-mencoderffmpeg/</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://onlydarksets.com/2008/09/19/convert-sage-recordings-to-iphone/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Transcoding for iPhone in Sage</title>
		<link>http://onlydarksets.com/2008/09/16/transcoding-in-sage/</link>
		<comments>http://onlydarksets.com/2008/09/16/transcoding-in-sage/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 18:49:38 +0000</pubDate>
		<dc:creator>onlydarksets</dc:creator>
				<category><![CDATA[DVRMSToolbox]]></category>
		<category><![CDATA[SageTV]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[babgvant]]></category>
		<category><![CDATA[ffmpeg]]></category>

		<guid isPermaLink="false">http://onlydarksets.wordpress.com/?p=403</guid>
		<description><![CDATA[I finally got around to rebuilding my HTPC (does anyone call them that anymore?) yesterday, so now I need to set my sights on getting file conversions working again.  I&#8217;m pretty set on using DTb for file monitoring and processing control.  For transcoding, I was going to use VLC (or possibly Handbrake), but I might [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got around to rebuilding my HTPC (does anyone call them that anymore?) yesterday, so now I need to set my sights on getting file conversions working again.  I&#8217;m pretty set on using <a href="http://www.babgvant.com/" target="_blank">DTb</a> for file monitoring and processing control.  For transcoding, <a href="http://onlydarksets.com/2008/07/06/mp4-tagging/" target="_self">I was going to use VLC</a> (or possibly <a href="http://handbrake.fr/" target="_blank">Handbrake</a>), but I might look at <a href="http://ffmpeg.mplayerhq.hu/" target="_blank">ffmpeg</a> instead.  Also, Sage <a href="http://www.google.com/search?q=SageTVTranscoder+site%3Asagetv.com" target="_blank">includes a transcoder</a>, which is apparently based on ffmpeg, but I&#8217;m not sure it adds anything over ffmpeg for me.</p>
<p>A couple more resources:</p>
<ul>
<li><a href="ftp://ftp4.mplayerhq.hu/MPlayer/releases/win32/MPlayer-mingw32-1.0rc2.zip" target="_blank">mencoder build</a> that can <a href="http://babgvant.com/forums/t/1937.aspx" target="_blank">cut/merge MPEG files without recoding</a></li>
<li><a href="http://ffdshow.faireal.net/mirror/ffmpeg/" target="_blank">ffmpeg</a> Windows binaries</li>
<li><a href="http://atomicparsley.sourceforge.net/" target="_blank">Atomic Parsley</a> (for writing MP4 metadata)</li>
<li><a href="http://babgvant.com/forums/p/644/3220.aspx#3220" target="_blank">Atomic Parsely Windows GUI</a> (just found this &#8211; haven&#8217;t tested it)</li>
<li><a href="http://babgvant.com/forums/p/644/3220.aspx#3220" target="_blank">Coyote&#8217;s iPod guide for DTb</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://onlydarksets.com/2008/09/16/transcoding-in-sage/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Convert for iPhone using mencoder/ffmpeg</title>
		<link>http://onlydarksets.com/2008/06/13/convert-for-iphone-using-mencoderffmpeg/</link>
		<comments>http://onlydarksets.com/2008/06/13/convert-for-iphone-using-mencoderffmpeg/#comments</comments>
		<pubDate>Sat, 14 Jun 2008 03:00:03 +0000</pubDate>
		<dc:creator>onlydarksets</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[ffmpeg]]></category>

		<guid isPermaLink="false">http://onlydarksets.wordpress.com/2008/06/13/convert-for-iphone-using-mencoderffmpeg/</guid>
		<description><![CDATA[UPDATE: Check out my even newer post for detailed instructions. UPDATE: Check my newer post for detailed instructions. I found this through the Google cache of I found this at http://www.dudek.org/blog/82.  I&#8217;m not sure why I couldn&#8217;t access it before, but, like Mark Twain, the reports of its death were greatly exaggerated.  For me, the [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATE: <a href="http://onlydarksets.com/2009/01/02/converting-sagetv-recordings-to-zuneipodiphone-version-20/">Check out my <strong>even newer post</strong> for detailed instructions.</a></p>
<p><span style="text-decoration: line-through;">UPDATE: <a href="http://onlydarksets.com/2008/09/19/convert-sage-recordings-to-iphone/">Check my newer post for detailed instructions</a>.</span></p>
<p><span style="text-decoration: line-through;">I found this through the Google cache of</span> I found this at <a href="http://www.dudek.org/blog/82">http://www.dudek.org/blog/82</a>.  I&#8217;m not sure why I couldn&#8217;t access it before, but, like Mark Twain, the reports of its death were greatly exaggerated.  For me, the most relevant part is the ffmpeg command line:</p>
<blockquote><p><strong><strong>iphone</strong> video</strong><br />
INFILE=&#8221;$1&#8243;<br />
OUTFILE=&#8221;$2&#8243;<br />
ffmpeg -f mp4 -vcodec mpeg4 -maxrate 1000 -b 700 -qmin 3 -qmax 5<br />
-bufsize 4096 -g 300 -acodec aac -ab 192 -s 480&#215;320 -aspect 4:3 -i &#8220;$INFILE&#8221; &#8220;$OUTFILE&#8221;<br />
This should be fine with any ipod-like device, but it is customized for the <strong>iPhone</strong> screen size. The <strong>-s 480&#215;320</strong> refers to the size of the <strong>iPhone</strong> screen; customization for the video iPod would use the same incantation, but with a screen size of 320&#215;240 to produce slightly smaller files. On the other hand, showing the video on TV would benefit from the larger size, or even 640&#215;480. The Apple TV uses as much as 1280&#215;720. (It is never worth using a larger size than your input footage, however, which is often limited to 640&#215;480 for NTSC.)</p></blockquote>
<p>I&#8217;ll look into whether ffmpeg can do dynamic aspect ratios like mencoder when I get a chance.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://onlydarksets.com/2008/06/13/convert-for-iphone-using-mencoderffmpeg/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Transcoding DVR-MS files for the Zune</title>
		<link>http://onlydarksets.com/2008/01/09/transcoding/</link>
		<comments>http://onlydarksets.com/2008/01/09/transcoding/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 15:12:14 +0000</pubDate>
		<dc:creator>onlydarksets</dc:creator>
				<category><![CDATA[Music/Video Players]]></category>
		<category><![CDATA[ffmpeg]]></category>

		<guid isPermaLink="false">http://onlydarksets.wordpress.com/2008/01/09/transcoding/</guid>
		<description><![CDATA[Most of the blog and forum postings out there for converting video for the Zune are for manual conversions. I haven&#8217;t found a whole lot of discussion on automatically converting from WMC DVR-MS files to a Zune-compliant format, and I have found next to nothing on converting HD DVR-MS. First, for manual conversion, there are [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the blog and <a href="http://forums.thoughtsmedia.com/showthread.php?t=768" target="_blank">forum</a> postings out there for converting video for the Zune are for manual conversions.  I haven&#8217;t found a whole lot of discussion on automatically converting from WMC DVR-MS files to a Zune-compliant format, and I have found next to nothing on converting HD DVR-MS.</p>
<p>First, for manual conversion, there are a few options out there that will create Zune-compliant WMV files (see <a href="http://www.zuneconverter.net/" target="_blank">this clearinghouse list</a>):</p>
<ul>
<li><a href="http://babgvant.com/default.aspx" target="_blank">DVRMSToolbox</a></li>
<li><a href="http://www.zunetvwatcher.com/" target="_blank">ZuneTVWatcher</a> (discussed <a href="http://forums.thoughtsmedia.com/showthread.php?t=772" target="_blank">here</a>)</li>
<li><a href="http://druidtranscoder.wetpaint.com/" target="_blank">Druid</a></li>
<li><a href="http://dcunningham.net/encode360/" target="_blank">Encode360</a> (endorsed <a href="http://happybeggar.com/index.php?option=com_content&amp;task=view&amp;id=68&amp;Itemid=" target="_blank">here</a>)</li>
<li><a href="http://babgvant.com/forums/thread/3815.aspx" target="_blank">jelwood&#8217;s mencoder</a> (<a href="http://babgvant.com/forums/25/ShowForum.aspx" target="_blank">discuss</a>)</li>
<li><a href="http://tmpgenc.pegasys-inc.com/en/product/te4xp.html" target="_blank">TMPGEnc Xpress 4.0</a> (endorsed <a href="http://www.zunester.com/2006/11/video-tools.html" target="_blank">here</a> and <a href="http://drewh70.wordpress.com/2007/03/04/transcoding-dvr-ms-video-for-the-zune/" target="_blank">here</a>, and by me for complex, one-off sources)</li>
<li><a href="http://mediacenter.mattgoyer.com/archives/2006/11/30/1191" target="_blank">Spb Mobile DVD</a></li>
</ul>
<p>However, the Zune now supports MP4 and h.264.  That opens up the options to any software that supports DVR-MS as an input and either of those codecs as an output.  A partial list:</p>
<ul>
<li><a href="http://babgvant.com/forums/thread/5149.aspx" target="_blank">ffmpeg</a> (<a href="http://babgvant.com/forums/25/ShowForum.aspx" target="_blank">discuss</a>)</li>
<li>PQ DVD to Zune (discussed <a href="http://drewh70.wordpress.com/2007/03/04/transcoding-dvr-ms-video-for-the-zune/" target="_blank">here</a>)</li>
</ul>
<p>Since I&#8217;m looking at solutions that can be automated, it will probably come down to DVRMSToolbox, ZuneTVWatcher, Encode360 (which has a command line), and ffmpeg.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://onlydarksets.com/2008/01/09/transcoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
