Video Blogging using Django and Flash(tm) Video (FLV) ? DRM - Daniel’s Random Mutterings

来源:百度文库 编辑:神马文学网 时间:2024/10/01 22:43:55

DRM - Daniel’s RandomMutterings

What I Read; What I Have Read; and stuff Ipick up and drag along
« PetPeeves In Grammar, #34I was dugg! »

Video Blogging using Django and Flash(tm) Video(FLV)

I just added Flash-based (FLV) video blogging support to my Django-powered travel portalsite, trogger.de. The whole processis surprisingly simple and straightforward and can be done entirely withfree (FLOSS) tools.

The video publishing workflow consists of the following parts:

  • A Django model to store our video and associated information
  • An upload form where the user can upload a video
  • Converting the video into a format usable on the Web
  • Extracting additional details
  • Playing the video in the Web browser
  • Making the player a bit friendlier
  • Advanced features

Following this simple workflow, trogger.deallows 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 blogentry, the attached video is shown in the browser.

The Django model

The Django model for storing the video is rather straightforward. Inaddition to storing the Video (or, rather, a reference to the videofile) in a FileField, I’ve added a reference to the blog submission withwhich the video is related (I use this to look up the video whenbrowsing the blog). Here’s my model, VideoSubmission:

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 )

In addition to the video FileField itself, I’ve added a “flvfilename”field to store the name of the converted movie file (see below).

Uploading the video

Video uploading is done using a normal File upload form. In the viewfor the upload form, we need to add the FormFields for the file uploadfields created by Django:

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'] = subreturn HttpResponse( t.render( c ) )

Our addvideo.html is pretty much the simplest upload form imaginable:

Video hochladen:
(Nur AVI und FLV werden akzeptiert)
{{ form.videoupload}} {{ form.videoupload_file }}
Kommentar:

I’ve added the related submission ID as a hidden field, so that thisgets submitted back to the upload process and I can create a linkbetween the video and the blog entry.

Converting the video for use in the site

The users are asked to upload AVI videos to the site, but we cannotplay AVI videos directly in the browser (at least not in abrowser-independent manner). A good way to publish videos for viewing ina 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 enoughfor them, it’s good enough for me!

Converting to FLV

So, how to convert the AVI video the user uploaded to a usable FLVformat? Luckily, the OSS package ffmpeg[2] provides this conversion functionality (plus a wide range of othervideo conversion features one of which we’ll come to later on). The goodthing about ffmpeg is that it is controlled entirely from thecommand-line and can be run in headless environments — this is vital forusing it on an application server. Most other FLV conversion tools wereeither for Windows or came with some form of Gnome or KDE gui whichwouldn’t have worked on my hosted Linux box.

The basic command for converting a video into FLV format is (see [1]in resources):

ffmpeg -i [sourcefile.avi] -acodec mp3 -ar 22050 -ab 32 -f flv -s320×240 [destfile.flv]

Adding FLV metadata

This command creates a simple FLV format file, containing the videoand audio streams. In addition, FLV files need meta-information such asduration, frames, etc. FLV movie players use this information tocalculate progress bar sliders and allow the user to fast-forward orreverse through the video. For reasons which I didn’t bother toresearch, ffmpeg does not add this information. But there is a packagewhich can: flvtool2 (see [3]). Using this tool, we can add FLVmeta-information with the following command:

flvtool2 -U [flvfile]

(Warning, Djangoists — flvtool2 is written in Ruby. Please check yourreligious language preferences at the door and pick them up as youleave. Thank you).

Adding a video thumbnail

Blog entries in trogger.de caninclude pictures uploaded by the users. One of these pictures isdisplayed as a small preview when showing the blog posting (e.g. in theblog overview, or in the list of the latest blog submissions). Wouldn’tit be nice if we could also add a thumbnail for a video submission, sothat the blog’s reader can get a first idea of what to expect? I thinkit would. And, again, ffmpeg comes to the rescue.

ffmpeg can extract single frames from a video stream, storing them instill image format. The command for doing this is:


ffmpeg -y -i [videofile] -vframes 1 -ss 00:00:02 -an -vcodec png -frawvideo -s 320×240 [thumbnailimage.png]

Putting it all together

With these individual steps, it’s EASY to put together a videoconversion function which kicks in once a user has uploaded a videofile. Since we have the information which video the user uploaded withthe form, we convert this video into FLV format, add metadata and createa thumbnail image:

def convertvideo (video):if video is None:return "Kein Video im Upload gefunden"filename = video.videouploadprint "Konvertiere Quelldatei: %s" + filenameif filename is None:return "Video mit unbekanntem Dateinamen"sourcefile = "%s%s" % (settings.MEDIA_ROOT,filename)flvfilename = "%s.flv" % video.idthumbnailfilename = "%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" % targetfileprint ("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 > 0 Bytestry:s = os.stat(targetfile)print sfsize = s.st_sizeif (fsize == 0):print "File is 0 Bytes gross"os.remove(targetfile)return ffmpegresultprint "Dateigroesse ist %i" % fsizeexcept:print sys.exc_info()print "File %s scheint nicht zu existieren" % targetfilereturn ffmpegresultflvresult = commands.getoutput(flvtool)print "-------------------- FLVTOOL ------------------"print flvresultgrab = commands.getoutput(grabimage)print "-------------------- GRAB IMAGE ------------------"print grabexcept:print sys.exc_info()return sys.exc_info[1]video.flvfilename = flvfilenamevideo.save()return None

Things to note

I’m keeping the media diectory for the uploads and the mediadirectory for the converted results separate. This way, I can later oneasily clear the upload area if I decide I don’t need the source videosany more (after all, they eat up valuable hosting space), without havingto bother about accidentally deleting the converted data. Yes, I’msometimes stupid in breathtakingly dumb ways. Also I can exclude thesource video files from the daily backup.

If something goes wrong with the conversion, I return the outputmessage from the conversion tool and actually display this in the Webpage, so the user can see if there was a problem. I’m not too sure thisis a good idea, yet. ffmpeg puts pathnames into its output, so the errormessage is exposing potentially exploitable information about thedirectory setup of my server. You might want to consider replacing pathnames before dumping the output message.

The converted video file is created in a subdirectory of the mediaroot 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 aboutanother unique naming scheme. The PNG image thumbnail also has the ID asa filename, but with a PNG extension (duh!).

Playing the video in the Web browser

Now that the video was uploaded and (hopefully) successfullyconverted, we need to provide a way of viewing it. For this, I use anFLV player component called FlowPlayer,avilable as a SourceForge project [4]. The FlowPlayer SWF is embeddedinto the page and parameters are provided based on information from thevideo. In the blog entry view, I look for a related video submissionwhich I pass in the context as “video”. The view template populates theSWF parameters using information from the “video” instance:

{% if video %}

Dein Browser scheint kein Flash-Plugin installiert zu haben

{{video.comment}}

{% endif %}

Note the inconspicuous “splashImageFile=clicktoplay.jpg” hidden inthe jumble of FLV parameters. FlowPlayer provides a very simple way ofspecifying a “splash screen” image which is displayed in place of thevideo until the user clicks on the Flash player to view the video. I’vecreated a trogger-themed splash screen and use this for all embeddedvideo submissions:

 

The end result

Thew end result is shown in the screenshot. A user-written blogentry, with an attached video which is played in the browser. Not badfor one day’s work, if I say so myself.


Conversion quality and size issues

Quality of the converted FLV videos is pretty good, even at lowerresolutions. Of course, YMMV or you may have other expectations. Usingthe conversion commands shown above, a 2.6MB camera movie was convertedinto an FLV file of 590kB. Depending on your intended use of the video(full-screen presentation?), and depending on how much bandwidth youwant to burn, you may want to fiddle with some quality and compressionparameters in ffmpeg.

Housekeeping

It is definitely a good idea to make sure that the FLV files are notactually served by Django, but directly by Apache (or even by anotherhttp server altogether). To serve the video files directly from Apache,we can exclude the video location “showvideo” from processing by Djangoby adding a section to the httpd.conf:

Alias /showvideo/ "/path/to/my/media/root/video/"SetHandler none

Also, we should consider limiting the size of uploads, since we don’twant to drown in uploaded video (and we don’t want to get out-of-memoryerrors from Django, which holds the entires file upload in memory atleast temporarily). As has been pointedout by Malcolm Tredinnick in the django-users group, this can beachieved using the LimitRequestBodydirective.

Open Issues

One issue that I haven’t been able to solve is adequate support formore video formats. Windows Media stuff provides so many proprietaryformats, codecs, etc., that it’s hard even for a project such as ffmpegto keep up. As a result, I’ve limited video upload to AVI files, andmake it quite clear to the uploader that potentially the video he’suploading cannot be used, due to format problems. AVI videos captured bymy digital camera (such as the diving video in the screenshot) can beconverted quite well. As soon as somebody recodes the video, converts itto WMV, there’s trouble (even more so if the video contains any DigitalRestrictions Management). There are loads of forum entries in the Netdiscussing potential solutions. Since they all involved hackingadditional (sometimes binary) codes into ffmpeg, I wasn’t adventurousenough to try them.

If anyone can point me at a reliable way of converting (unprotected)WMV files and other video formats into FLV format, I would be verygrateful.

I discovered that MPlayer can also be used for such conversions andcan also be run in a headless environment; since conversion with ffmpegworked, I didn’t do any more experiments — maybe someone else canenlighten me as to wether MPlayer would actually be better or cope withmore formats?

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 aresult. For larger video submissions it might be useful to decouple thevideo processing and do it in a separate thread, updating the blog entrywhen finished.

Resources

[1] ffmpeg
http://ffmpeg.mplayerhq.hu/

[3] flvtool2
http://rubyforge.org/projects/flvtool2/

[4] FlowPlayer
http://flowplayer.sourceforge.net/

Tags: Django;Python; FLV; video; trogger

P.S. You can check out a blog entry with video submission in mytrogger blog at http://www.trogger.de/blog/8/60/mit-mantas-tauchen-vor-machchafushi/fullentry/.

Bookmark on del.icio.us
Addthis post to digg.com
Bookmarkon reddit.com

Posts related to this one:
  • Cited in Bangalore - How cool is that?
  • Inspiration for a RentaCoder listing
  • Stealing Blog Content for Fun and Profit

55 Responses to “Video Blogging using Django andFlash(tm) Video (FLV)”

  1. Nick Says:

    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?

    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 .

    It’s just too bad that doing this reencoding legally in the USA would be difficult and probably requires licenses from countless patent holders . (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.)

    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 FFMpeg sounds like it has potential problems too, though only of a patent/reverse-engineering nature instead of a copyright/license-agreement nature).

    I think you should check out PyMedia 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). This discussion mentions some other python libraries for dealing with video, though I’ve never really looked at any of the others.

    Anyway, I look forward to future django posts from you!

  2. Simon Says:

    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.

  3. Daniel Tietze Says:

    Simon - 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 http://www.nosoftwarepatents.com/

  4. http://www.fabianrodriguez.com Says:

    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 :
    http://www.v2v.cc/~j/ffmpeg2theora/

    Extracting metadata from Ogg Theora files may be done with ogginfo in command line.

    Many fine resources about Ogg Theora can be found with Google or at http://del.icio.us/search/?all=theora

  5. Jason Toffaletti Says:

    Flashticle might be better than flvtool.

    http://undefined.org/python/#flashticle

    If you’re using python2.4 you should the subprocess module instead of commands for security reasons.

    Nick asked:
    “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”

    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.

    [1] http://twistedmatrix.com
    [2] http://divmod.org/trac/wiki/DivmodNevow

  6. Daniel Tietze Says:

    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).
    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.
    The simplest architecture I was envisioning was just calling the conversion process in the background ( “nohup ffmpeg […) &” ), 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?

  7. t3knoid’s cyberlog » Video Blogging using Django and Flash Video (FLV) Says:

    […] Maybe someday, I’ll have the time to putting a Drupal module together using these methods.read more | digg story –> […]

  8. Campbell Says:

    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.
    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.

    Cheers

    Campbell

  9. Campbell Says:

    P.S. its super slow cause its on a server in my cupboard and on my home connection.

  10. Un “You Tube” 100% OpenSource — Ouvert 24 heures - Verres stérilisés Archive Says:

    […] 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 […]

  11. Yet Another Blog from Luar » FFmpeg usage command Says:

    […] Video Blogging using Django and Flash(tm) Video (FLV)   […]

  12. eLearning Skinny » Blog Archive » Shall We Roll Our Own YouTube for BarCamp Vancouver? Says:

    […] 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). […]

  13. Dotpod — ¿Cómo crear tu propio YouTube? Says:

    […] 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. […]

  14. Eric Kersten Weblog » Blog Archive » Crea tu propio YouTube Says:

    […] El link aca: http://blog.go4teams.com/?p=56 […]

  15. Evert Says:

    FFMpeg now supports FLV 1.1, so you don’t need the FLVTool2 part anymore.. I wrote a small entry about this

  16. felipeandrade.org » “You tube” 100% Open Source Says:

    […] Você pode encontrar mais detalhes no link abaixo: http://blog.go4teams.com/?p=56 […]

  17. EveryDigg » Blog Archive » Video Blogging using Django and Flash Video (FLV) Says:

    […] "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 […]

  18. nooree style » Blog Archive » How to create your own YouTube site Says:

    […] 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 - how clever) explains exactly how to do this with open source tools. […]

  19. Sebastian Says:

    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.

  20. www.blogmemes.net Says:

    Your own youtube like hosting service ?

    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.

  21. Jimleouf Says:

    Hi there,
    I just start with Django and i’m still not familiar with it.
    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.
    jimleouf_at_gmail.com
    Thanks

    Jimleouf

  22. franky Says:

    i tried your flv conversion setting, but video quality is not so good when compared with “flash 8 video encoder”..
    is there any settings that can improve the video quality?

    i have “-b 1000 -ar 44100 -ab 64 -s 750×600″

    thanks

  23. spam: the other white meat » A Drupal youtube Site Recipe Says:

    […] Video Blogging using Django and Flash(tm) Video (FLV) […]

  24. Tech Industry » Video Blogging using Django and Flash Video (FLV) Says:

    […] “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 […]

  25. Samuel J. Greear Says:

    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. http://flixn.com/ .. and http://flixn.com/developers/

  26. Daniel Tietze Says:

    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.
    As a Linux/Firefox user that’s pretty much a deal-killer right there.

  27. Samuel J. Greear Says:

    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.

  28. Tim Says:

    Great stuff!!
    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

  29. Daniel Tietze Says:

    We have a long weekend coming up in Germany. I’ll maybe try and get something updated.

  30. Colin Esbensen Says:

    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.

    Cheers, Colin

  31. gumango Says:

    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.

  32. Pradeep B V Says:

    Hey Daniel,

    I have used parts of your post for my presentation at BarCampBangalore.

    Thanks a ton.

  33. creating a You tube or streaming server - MacNN Forums Says:

    […] 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 - Daniel’s Random Mutterings digg - 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. […]

  34. Internet and Network Art » FFMPEG Says:

    […] http://www.jessewarden.com/archives/2006/09/serverside_ffmpeg.html […]

  35. Video konvertierung mittels php & apache wie in youtube - PHP @ tutorials.de: Forum - Tutorials - Hilfe - Schulung & mehr Says:

    […] AW: Video konvertierung mittels php & apache wie in youtube Hey, siehe hier: http://blog.go4teams.com/?p=56 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: […]

  36. mcdave.net » links for 2007-01-20 Says:

    […] Video Blogging using Django and Flash(tm) Video (FLV) » DRM - Daniel’s Random Mutterings (tags: video flash django tutorial python flv) […]

  37. Digital Motion dot net » Some flashy goodness for your Tuesday morning Says:

    […] Finally, Daniel Tietze tell you how to make your own uTube. –> […]

  38. Realizzare un Clone di YouTube « Scaracco Says:

    […] Ispirazione: Video Blogging using Django and Flash(tm) Video (FLV) […]

  39. FLV converter Says:

    […] Finally, FLV converter tell you how to make your own uTube. –> […]

  40. FLV converter Says:

    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…

  41. FLV converter Says:

    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

  42. Jack Says:

    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!

  43. David Lavoie Says:

    I had an issue using FFMPEG with linux.
    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?
    Any idea how to ensure that the output of FFMPEG run by PHP could be redirected to /dev/null or somthing?

  44. Zalapao Press » Blog Archive » FFmpeg usage command Says:

    […] Video Blogging using Django and Flash(tm) Video (FLV) […]

  45. iGloo Says:

    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.

    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.

    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.

    Here the revelant mencoder part:

    #!/bin/sh
    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 \
    -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 \
    -vf scale=320:240 -srate 22050 -af lavcresample=22050

    /usr/local/bin/flvtool2 -U .flv

  46. pat Says:

    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

  47. links for 2007-07-06 « PaxoBlog Says:

    […] Video Blogging using Django and Flash(tm) Video (FLV) » DRM - 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) […]

  48. Michael Says:

    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 http://blog.gwikzone.org/articles/2006/09/25/flv-encoding-with-ffmpeg also the option changed and copied manually libmp3lame.so.0 to the right location)

    I really start to like django…

  49. Alce Says:

    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.

  50. HenrikG Says:

    I had some problems getting ffmpeg to work with mp3 encoding on Ubuntu Linux. First configuration:
    ./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-libx264

    The problem occured when I compiled ffmpeg with “make”:

    Imlib2.h:108: error: syntax error before “*” token

    I solved this by installing Imlib2 from source:
    href=”http://sourceforge.net/project/showfiles.php?group_id=2
    (check at the bottom of the page)

    I also installed a lot of libs to get the compilation to work:

    apt-get build-dep ffmpeg
    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

  51. Plantillas para Blogger, recursos y herramientas » Como crear tu propio Youtube y ganar dinero en internet añadiendo Video Ads. Says:

    […] 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. […]

  52. Video Blog mit TYPO3? - TYPO3forum.net Says:

    […] 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? […]

  53. How to create your own YouTube site Says:

    […] A recent post at Daniel’s Random Mutterings explains how to do this with open source tools. Filed Under Design & development […]

  54. FFmpeg usage command | Gone with the wind Says:

    […] Video Blogging using Django and Flash(tm) Video (FLV) […]

  55. Proposal - Video Blogger for Cat Facts! » PAWSit Says:

    […] Create Your Own YouTube […]

Leave a Reply


DRM - Daniel’s Random Mutterings -- powered by WordPress
Entries (RSS)and Comments(RSS).