[Red5devs] Taking a snapshot from a live video feed

Walter Tak walter at waltertak.com
Wed Sep 3 06:41:47 PDT 2008


It's pretty simple ; 

See http://pastebin.com/m15ae8f99 for a PHP-function/script that downloads the file 

The PHP function [copy] does the trick. (Had to figure out which function the ISP supported and in the end [copy] produces the lowest load on the server)

Walter

  ----- Original Message ----- 
  From: Valentin Manthei 
  To: red5devs at osflash.org 
  Sent: Wednesday, 03 September 2008 15:10
  Subject: Re: [Red5devs] Taking a snapshot from a live video feed


  Hi Walter,

  your opinion fits with my thoughts about the heavy server load with many live streams at a time.
  I think about doing the processing in Red5, that would require a scheduling job and a deeper look at flv/jpeg data structure.

  Doing the processing on another machine like you described seems to be a nice solution, too. Are you so kind to post the php script if possible? That would help a lot.

  Best regards,
  Valentin

  Walter Tak schrieb: 
    Np,

    btw David uses ffmpeg on Red5 
:Process p =  Runtime.getRuntime().exec(this.FFMPEG+" -f 
flv -i - -vcodec png -vframes 1 -an -f rawvideo -s 160x120 
"+OUTPUTPATH+stream.getPublishedName()+".png");I've altered the class a bit a my app is calling a PHP-script ( using RemotingClient ) on another server which in order does the actual processing from FLV to JPG since I don't want to do the heavy ffmpeg processing on my expensive Red5 server.

    After the 1-frame FLV is extracted to a directory that's accessable via http (the jetty http server on 5080 or you could use tomcat or Apache to expose the directory) the php-script 'downloads' (using curl or fopen) the 1-frame-FLV from the Red5 server to the webserver (different physical machine, could also be located in a different country/datacentre).

    It isn't complicated and seperates the after-effects processing quite nicely.

    I didn't want to have 200 ffmpeg processes every 30 seconds running on a live-streaming Red5 server you see ; the webserver however is a cheap node that could be load balanced by adding a few more physical servers to do the conversion job, if it would be too much to be handled by 1 server.

    Walter




      Thanks for the hint, Walter. I haven't found that thread in my search before.
      http://osflash.org/pipermail/red5_osflash.org/2008-January/018263.html

      Valentin

      Walter Tak schrieb: 
Check the normal Red5 archives ; me and David Temes have discussed it and 
David made a 'snapshot' class which does exactly what you need ; it extracts 
a frame from the incoming FLV. You can convert that frame with ffmpeg 
(outside of Red5) to any fileformat like a JPG and use that 
snapshot/thumbnail to display on a frontpage for example to show ppl which 
livestreams are available and how they look like.

This does require some java-knowledge of (java/red5) schedulers , 
installation , compilation and execution of ffmpeg.

Subject "Re: [Red5] SnapshotListener" in January and February 2008.

Walter

  Hi everybody!

There are some topics about taking snapshots from a video stream on the
client using ActionScript 3, converting it into a ByteArray, encoding,
uploading, etc...

My question is about how to extract a jpeg image from a stream in the
Red5 server, better in the webapp itself.
The streams are published as "live", so there will be no file on the
disk I can operate with. Otherwise I would use ffmpeg to take a 
snapshot...

Is there a way to create a jpeg from the flv data in Red5? Where is the
point I have to start looking?

Thanks in advance,
Valentin
    

_______________________________________________
Red5devs mailing list
Red5devs at osflash.org
http://osflash.org/mailman/listinfo/red5devs_osflash.org

  



--------------------------------------------------------------------------
      _______________________________________________
      Red5devs mailing list
      Red5devs at osflash.org
      http://osflash.org/mailman/listinfo/red5devs_osflash.org



--------------------------------------------------------------------------
      No virus found in this incoming message.
      Checked by AVG. 
      Version: 7.5.524 / Virus Database: 270.6.15/1648 - Release Date: 02-09-08 17:29

----------------------------------------------------------------------------
_______________________________________________
Red5devs mailing list
Red5devs at osflash.org
http://osflash.org/mailman/listinfo/red5devs_osflash.org
  



------------------------------------------------------------------------------


  _______________________________________________
  Red5devs mailing list
  Red5devs at osflash.org
  http://osflash.org/mailman/listinfo/red5devs_osflash.org



------------------------------------------------------------------------------


  No virus found in this incoming message.
  Checked by AVG. 
  Version: 7.5.524 / Virus Database: 270.6.15/1648 - Release Date: 02-09-08 17:29
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/red5devs_osflash.org/attachments/20080903/1ddd15c8/attachment-0001.html 


More information about the Red5devs mailing list