# Custom module to create single frame snapshots of live and VOD stream

**URL:** https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38
**Category:** Wowza Streaming Engine
**Created:** [November 7, 2007, 7:44am UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38 "2007-11-07T07:44:04Z")
**Posts on this page:** 13
**Page:** 5

<div class="post-metadata">

### Author: ![Nischal\_Reddy\_Bomdik](https://avatars.discourse-cdn.com/v4/letter/n/a87d85/32.png) [@Nischal\_Reddy\_Bomdik](https://community.wowza.com/u/Nischal_Reddy_Bomdik)
#### Post date: [July 27, 2010, 7:19am UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/81 "2010-07-27T07:19:34Z")

</div>

I got the web service to work by following the example code. I am using a proxy of the web service and now i need to access the Wowza modules to iterate over the files in the content folder and run ffmpeg on them. I am stuck here. Can you please help me out with some example code or ways to do this?

PS: i tried to do it through HTTProvider but failed. It didn’t make much sense to me as i am new to it. So i am going through web services.

---

<div class="post-metadata">

### Author: ![Nischal\_Reddy\_Bomdik](https://avatars.discourse-cdn.com/v4/letter/n/a87d85/32.png) [@Nischal\_Reddy\_Bomdik](https://community.wowza.com/u/Nischal_Reddy_Bomdik)
#### Post date: [August 2, 2010, 2:05pm UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/82 "2010-08-02T14:05:31Z")

</div>

Thank you for the reply.

I built the ModuleVideoNameList in the IDE and i put the jar file in the [install]/lib . I created and set up the web service and i am able to get the server version by using getServerVersion(). I added the module inthe application.xml files for all the applications(live,vod,etc) that i am using.

I am able to get methods like startmediacasterstream, stopmediacasterstream,getserverversion, bind and so on. But i do not find any methods associated to the ModuleVideoNameList module. How do i access that module? I read through the user guide but i cannot use netconnection as i am using .net.

Please help me out. 😕

---

<div class="post-metadata">

### Author: ![Nischal\_Reddy\_Bomdik](https://avatars.discourse-cdn.com/v4/letter/n/a87d85/32.png) [@Nischal\_Reddy\_Bomdik](https://community.wowza.com/u/Nischal_Reddy_Bomdik)
#### Post date: [August 2, 2010, 2:46pm UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/83 "2010-08-02T14:46:45Z")

</div>

I looked at that code before but i am using a .NET client application so i do not have any scope to use the AS code.

I just want to know how to access the ModuleVideoNameList after building it and i also have the web service running. I just need to figure out a way to access the module from the .NET client application using a web service.😕

I basically cannot use “NetConnection”

---

<div class="post-metadata">

### Author: ![Nischal\_Reddy\_Bomdik](https://avatars.discourse-cdn.com/v4/letter/n/a87d85/32.png) [@Nischal\_Reddy\_Bomdik](https://community.wowza.com/u/Nischal_Reddy_Bomdik)
#### Post date: [August 2, 2010, 3:47pm UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/84 "2010-08-02T15:47:16Z")

</div>

Do you have a HTTProvider version of the ModuleVideoNameList?

Else can you tell me how to tweak the Module to make it HTTProvider?

The Module version extends from ModuleBase.

(OR)

I configured the web service and its running so if you can help me with the Web Service method, that would work too.

PS: I did not find any XML output related stuff in the second link you sent.

Thanks a lot!!

---

<div class="post-metadata">

### Author: ![capos\_capos](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@capos\_capos](https://community.wowza.com/u/capos_capos)
#### Post date: [September 23, 2011, 5:25pm UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/85 "2011-09-23T17:25:39Z")

</div>

[PHP]

package com.YOURCOMPANY.wms.previews;

import java.io.OutputStream;

import java.util.List;

import java.util.Map;

import com.wowza.util.FLVUtils;

import com.wowza.wms.amf.AMFPacket;

import com.wowza.wms.application.IApplicationInstance;

import com.wowza.wms.application.WMSProperties;

import com.wowza.wms.http.IHTTPProvider;

import com.wowza.wms.http.IHTTPRequest;

import com.wowza.wms.http.IHTTPResponse;

import com.wowza.wms.stream.IMediaStream;

import com.wowza.wms.stream.MediaStreamMap;

import com.wowza.wms.vhost.HostPort;

import com.wowza.wms.vhost.IVHost;

public class StreamsPreview implements IHTTPProvider {

IApplicationInstance appInstance;

public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {

if(appInstance == null)

appInstance = vhost.getApplication(“YOURAPP”).getAppInstance(“_definst_”);

resp.setHeader(“Content-Type”, “video/x-flv”);

OutputStream out = resp.getOutputStream();

Map\<String, List\> params = req.getParameterMap();

if (params.containsKey(“preview”))

{

String action = params.get(“preview”).get(0);

MediaStreamMap streams = appInstance.getStreams();

IMediaStream stream = streams.getStream(action);

if (stream != null)

{

AMFPacket packet = stream.getLastKeyFrame();

if (packet != null)

{

FLVUtils.writeHeader(out, 0, null);

AMFPacket codecConfig = stream.getVideoCodecConfigPacket(packet.getAbsTimecode());

if (codecConfig != null)

FLVUtils.writeChunk(out, codecConfig.getDataBuffer(), codecConfig.getSize(), 0, (byte)codecConfig.getType());

FLVUtils.writeChunk(out, packet.getDataBuffer(), packet.getSize(), 0, (byte)packet.getType());

}

}

}

}

public void onBind(IVHost vhost, HostPort hostPort) {

}

public void onUnbind(IVHost vhost, HostPort hostPort) {

}

public void setProperties(WMSProperties properties) {

}

}

[/PHP]

have fun 🆒

---

<div class="post-metadata">

### Author: ![Nikola\_Denic](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@Nikola\_Denic](https://community.wowza.com/u/Nikola_Denic)
#### Post date: [March 14, 2012, 3:40pm UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/86 "2012-03-14T15:40:04Z")

</div>

Is this working for getting one frame from mp4 h264 file ?

---

<div class="post-metadata">

### Author: ![Romans\_Brovsk](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Romans\_Brovsk](https://community.wowza.com/u/Romans_Brovsk)
#### Post date: [August 4, 2011, 9:21am UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/87 "2011-08-04T09:21:06Z")

</div>

Hello, I need to do wowza screenshot every 2 minutes all publish live stream

I need to write a custom module? Or is there existing solutions?

I looked [https://www.wowza.com/docs/how-to-take-a-single-frame-snapshot-of-a-live-stream-for-thumbnail-creation-modulecreatesnapshot](https://www.wowza.com/docs/how-to-take-a-single-frame-snapshot-of-a-live-stream-for-thumbnail-creation-modulecreatesnapshot), but I need to do wowza screenshots without calling functions from flash client.

---

<div class="post-metadata">

### Author: ![Romans\_Brovsk](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Romans\_Brovsk](https://community.wowza.com/u/Romans_Brovsk)
#### Post date: [August 4, 2011, 9:21am UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/88 "2011-08-04T09:21:45Z")

</div>

del

---

<div class="post-metadata">

### Author: ![Romans\_Brovsk](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Romans\_Brovsk](https://community.wowza.com/u/Romans_Brovsk)
#### Post date: [August 5, 2011, 11:28am UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/89 "2011-08-05T11:28:38Z")

</div>

is it possible to do this without Action Script? that

WoWza save snapshot of stream every 10 minutes?

---

<div class="post-metadata">

### Author: ![Bingo\_Jake](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Bingo\_Jake](https://community.wowza.com/u/Bingo_Jake)
#### Post date: [July 1, 2012, 5:28pm UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/90 "2012-07-01T17:28:34Z")

</div>

would it be possible to create single frame snapshot from a frame between 2 keyframes? the code take the packet from last keyframe in the stream.

The keyframe interval of my source video (Live H.264 MP4 stream from a camera) is set to 25 (unfortunately the camera doesn’t let me set the interval to smaller than 25)

but I need to create a snapshot every 2 seconds.

Thanks

---

<div class="post-metadata">

### Author: ![Bingo\_Jake](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Bingo\_Jake](https://community.wowza.com/u/Bingo_Jake)
#### Post date: [July 2, 2012, 8:55am UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/91 "2012-07-02T08:55:04Z")

</div>

Thank you for your quick response, but I can’t set the FPS to a high number because we don’t have enough upstream bandwidth at the camera location ☹

probably have to find another camera

---

<div class="post-metadata">

### Author: ![Loc\_Truong](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Loc\_Truong](https://community.wowza.com/u/Loc_Truong)
#### Post date: [June 23, 2013, 6:21pm UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/92 "2013-06-23T18:21:07Z")

</div>

Dear all,

I’m integrating this module into our Wowza and got a problem when running ffmpeg.

The command is

```auto
ffmpeg -i deathemperor_99050400.flv -vcodec png -vframes 1 -an -f rawvideo -s 320x240 thumbnail.png

```

The error I got from ffpmeg:

```auto
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
  libavutil 50.15. 1 / 50.15. 1
  libavcodec 52.72. 2 / 52.72. 2
  libavformat 52.64. 2 / 52.64. 2
  libavdevice 52. 2. 0 / 52. 2. 0
  libavfilter 1.19. 0 / 1.19. 0
  libswscale 0.11. 0 / 0.11. 0
  libpostproc 51. 2. 0 / 51. 2. 0
[flv @ 0x209b670]Could not find codec parameters (Audio: 0x0000, 0 channels)
[flv @ 0x209b670]Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (50/2)
Input #0, flv, from 'deathemperor_99050400.flv':
  Metadata:
    duration : 0
    creationdate : Sun Jun 23 01:09:09
  Duration: 00:00:00.00, start: 0.080000, bitrate: N/A
    Stream #0.0: Video: h264, yuv420p, 1280x720, 25 tbr, 1k tbn, 50 tbc
    Stream #0.1: Audio: 0x0000, 0 channels
File 'thumbnail.png' already exists. Overwrite ? [y/N] y
Output #0, rawvideo, to 'thumbnail.png':
  Metadata:
    encoder : Lavf52.64.2
    Stream #0.0: Video: png, rgb24, 320x240, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 0 fps= 0 q=0.0 Lsize= 0kB time=10000000000.00 bitrate= 0.0kbits/s dup=0 drop=1
video:0kB audio:0kB global headers:0kB muxing overhead -nan%

```

I tried opening the FLV file with VLC, it shows an error while opening with Media Player Classic is fine. I then went to check the file’s header it’s something like this:

```auto
General
Complete name : F:\tmp\deathemperor_100850400.flv
Format : Flash Video
File size : 45.7 KiB
Duration : 40ms
Overall bit rate : 9 356 Kbps
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : 7
Duration : 40ms
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Audio

```

This gives me a meaning that the FLV with one frame is missing a lot of info in its header. Not sure if this causes the problem when running ffmpeg?

The FLV file is here: [http://tv.csmtalk.vcdn.vn/death/deathemperor\_100850400.flv](http://tv.csmtalk.vcdn.vn/death/deathemperor_100850400.flv), created by Wowza the same method guided in this thread

---

<div class="post-metadata">

### Author: ![Loc\_Truong](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@Loc\_Truong](https://community.wowza.com/u/Loc_Truong)
#### Post date: [June 25, 2013, 11:11am UTC](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38/93 "2013-06-25T11:11:45Z")

</div>

I got it working, thanks.

[Previous page](https://community.wowza.com/t/custom-module-to-create-single-frame-snapshots-of-live-and-vod-stream/38.md?page=4)
