Wowza Community

Record multiple videos from a live web cam stream

Try it without setting outputPath.

Richard

It has worked in all my tests

Richard

Test by hard-coding path to Wowza content folder + file name in outputPath. That will eliminate permission problems.

Richard

This was my test:

  • Publish RTMP stream

    Server: rtmp://localhost:1935/liverecord

    Stream: myStream

  • Started a stream

    http://localhost:1935/livestreamrecord?app=liverecord&streamname=myStream&action=startRecording&format=2&output=C:/temp/mycoolvideo.mp4
    
  • Stopped a stream

    http://localhost:1935/livestreamrecord?app=liverecord&streamname=myStream&action=startRecording&format=2&output=C:/temp/mycoolvideo.mp4
    
  • Tested C:/temp/mycoolvideo.mp4 with WMP, VLC, Flash. All good

  • Also tried with URL encoded string to location:

    http://localhost:1935/livestreamrecord?app=liverecord&streamname=myStream&action=startRecording&format=2&output=C:\Program%20Files%20(x86)\Wowza%20Media%20Systems\Wowza%20Media%20Server%203\content\mycoolvideo.mp4
    
    

    Richard

There are other ways to move or copy a recording after it is finished:

Configurable method:

https://www.wowza.com/docs/how-to-move-recordings-from-live-streams

API:

https://www.wowza.com/docs/how-to-use-imediawriteractionnotify-to-programmatically-move-and-rename-recordings-of-live-streams

Richard

I’ll test on Linux server using Wowza EC2 ami-79834b10, which I think is Fedora.

Richard

I tested on small ec2 instance, Fedora, the AMI mentioned previously. It all works for me. I publish myStream and used LiveStreamRecord HTML form and querystring methods to record and save it to /tmp/mycoolvideo.mp4

Start:
http://ec2-nn-nn-nn-nn.compute-1.amazonaws.com:1935/livestreamrecord?app=live&streamname=myStream&action=startRecording&format=2&output=/tmp/mycoolvideo.mp4
Stop:
http://ec2-nn-nn-nn-nn.compute-1.amazonaws.com:1935/livestreamrecord?app=live&streamname=myStream&action=stopRecording

Richard

Use IMediaStream.sendDirect for recording.

Richard

gabole29,

If you restart Wowza can you then record to the folders that you had previously created?

Can you explain more about how you’re doing your recording? URLs, Wowza logs, steps to reproduce, etc… Try to provide as much detail as possible.

Hi,

Thanks for the explanation. My content folder’s permissions are set 775. Why do you need to set the owner and group permissions differently? I suspect this is a permissions issue. Can you post the Wowza errors when you start and stop the stream. And can you post the output of “ls -la” that shows the permissions of the folders?

Try setting up the LiveStreamRecord Addon as specified in the README.html, and then try recording to “on-the-fly” paths from the included LiveStreamRecord_3.0/clientHTTP/HTTPLiveStreamRecord.html client. Then you will have a working example. If you can do that, then this points to a problem with your custom code.

What is your Wowza version?

I recall that I was seeing some 1k .mp4 files when using the LiveStreamRecord addon until I upgraded to patch 10. You should try that. The latest dev builds are here: https://www.wowza.com/docs/wowza-streaming-engine-software-updates

And you’re just using the standard videorecording example? Can you provide specific steps for me to reproduce this problem?

Hi gabole,

Sorry we haven’t found the solution yet. It seems unlikely to me that there is something in Ubuntu but not in Fedora that causes flv files to be written with meta-data only when specifying an alternate path. It’s most likely a configuration issue. Try to post exactly the commands like you are using, so we can spot a potential problem.

You mentioned: “if i publish in “videorecording/1000” and specify “videorecording/1000”, the http provider returns me “Error: null””

So if you mean you tried this?:

http://[Wowza-Server-IP]:1935/livestreamrecord?app=videorecording/1000&streamname=myStream&action=startRecording&format=2&output=/tmp/mycoolvideo.mp4

This will not work. You are publishing to app “videorecording” and app-instance “1000”. But, the module only allows you to choose the app. I posted some code that allows you to specify the app instance. Let me know if you need me to dig it up for you. But, I think first we need to fix your issue with output path.

I just noticed “recordOptions2.format = “flv”;”

Try setting “recordOptions2.format = “1”;”

Use 1 for flv and 2 for mp4, same with the HTTPProvider.

http://[Wowza-Server-IP]:1935/livestreamrecord?app=live&streamname=myStream&action=startRecording&format=2&output=/tmp/mycoolvideo.mp4

Have you tried Richard’s URL?

It works for me in Debian publishing via FMLE to app: “RTMP://[Wowza-Server-IP]/live” and streamname: “myStream”:

/usr/local/WowzaMediaServer/bin# ./startup.sh
/usr/local/WowzaMediaServer/lib/
Configure logging: file:///usr/local/WowzaMediaServer/conf/log4j.properties
INFO server server-start Wowza Media Server 3 Monthly Edition 3.0.3.10 build995 -
INFO server comment - Server License Key: SVRM3-XXXXX-XXXXX-XXXXX-XXXXX-FsakF
INFO server comment - Maximum Connections: Unlimited
INFO server comment - Transcoder Streams Available: Transcoder Not Available (linux-32)
INFO server comment - nDVR Available: Yes
INFO server comment - DRM Available: Yes
INFO server comment - Hardware Available Processors: 2
INFO server comment - Hardware Physical Memory: 201MB/3540MB
INFO server comment - Hardware Swap Space: 6914MB/6914MB
INFO server comment - Max File Descriptor Count: 20000
INFO server comment - Open File Descriptor Count: 49
INFO server comment - OS Name: Linux
INFO server comment - OS Version: 2.6.32-5-686
INFO server comment - OS Architecture: i386
INFO server comment - Java Name: OpenJDK Server VM
INFO server comment - Java Vendor: Sun Microsystems Inc.
INFO server comment - Java Version: 1.6.0_18
INFO server comment - Java VM Version: 14.0-b16
INFO server comment - Java Spec Version: 1.6
INFO server comment - Java Home: /usr/lib/jvm/java-6-openjdk/jre
INFO server comment - Java Max Heap Size: 1155MB
INFO server comment - Java Architecture: 32
INFO server comment - Java Locale[user.language]: en
INFO server comment - Java Locale[user.country]: US
INFO server comment - Java Locale[file.encoding]: UTF-8
INFO server comment - Java Args[0]: -Xmx1200M
INFO server comment - Java Args[1]: -Djava.net.preferIPv4Stack=true
INFO server comment - Java Args[2]: -Dcom.sun.management.jmxremote=true
INFO server comment - Java Args[3]: -Dcom.wowza.wms.runmode=standalone
INFO server comment - Java Args[4]: -Dcom.wowza.wms.native.base=linux
INFO server comment - Java Args[5]: -Dcom.wowza.wms.AppHome=/usr/local/WowzaMediaServer
INFO server comment - Java Args[6]: -Dcom.wowza.wms.ConfigURL=
INFO server comment - Java Args[7]: -Dcom.wowza.wms.ConfigHome=/usr/local/WowzaMediaServer
INFO server comment - Server runmode: standalone
INFO server comment - Server native.platform: linux
INFO server comment - Server threads[h/t]: 10/10
INFO server comment - CMDInterface now listening: [any]:8083
INFO vhost vhost-start _defaultVHost_ -
INFO server comment - _defaultVHost_ threads[h/t]:120/80 home:/usr/local/WowzaMediaServer
INFO vhost comment _defaultVHost_ Bind attempt ([any]:1935:4)
INFO vhost comment _defaultVHost_ Bind successful ([any]:1935)
INFO vhost comment _defaultVHost_ Bind attempt ([any]:8086:1)
INFO vhost comment _defaultVHost_ Bind successful ([any]:8086)
INFO server comment - ServerListenerLoadBalancerSender.onServerInit
INFO server comment - LoadBalancerEdge.parseEdgeList: /usr/local/WowzaMediaServer/conf/loadbalancertargets.txt
INFO server comment - LoadBalancerEdge.parseEdgeList: target:204.39.122.xx:1934
INFO server comment - ServerListenerLoadBalancerListener.onServerInit
INFO server comment - LoadBalancerListener.bind: 0.0.0.0/0.0.0.0:1934
INFO server comment - Wowza Media Server is started!
INFO server comment - LoadBalancerServer.handleMessage[2bca3afc-1e4e-46a0-a42c-fca16d1492c7]: status: RUNNING
INFO server comment - ModuleStreamRecord.onAppStart
INFO application app-start _definst_ live/_definst_
INFO session connect-pending  -
INFO session connect  -
INFO stream create - -
INFO stream publish myStream -
INFO server comment - ModuleStreamRecord HTTPRequest
INFO server comment - ModuleStreamRecord action: startRecording
INFO server comment - ModuleStreamRecord app: live
INFO server comment - ModuleStreamRecord streamName: myStream
INFO server comment - ModuleStreamRecord outputPath: /tmp/mycoolvideo.mp4
INFO server comment - ModuleStreamRecord append: false
INFO server comment - ModuleStreamRecord version: true
INFO server comment - ModuleStreamRecord startOnKeyFrame: false
INFO server comment - ModuleStreamRecord recordData: true
INFO server comment - ModuleStreamRecord format (1=flv, 2=mp4): 2
INFO server comment - ModuleStreamRecord.startRecording
ls
INFO server comment - ModuleStreamRecord HTTPRequest
INFO server comment - ModuleStreamRecord action: stopRecording
INFO server comment - ModuleStreamRecord app: live
INFO server comment - ModuleStreamRecord streamName: myStream
INFO server comment - ModuleStreamRecord outputPath: null
INFO server comment - ModuleStreamRecord append: false
INFO server comment - ModuleStreamRecord version: true
INFO server comment - ModuleStreamRecord startOnKeyFrame: false
INFO server comment - ModuleStreamRecord recordData: true
INFO server comment - ModuleStreamRecord format (1=flv, 2=mp4): 1
INFO server comment - ModuleStreamRecord.stopRecording: myStream
^CINFO server comment - ServerListenerLoadBalancerSender.onServerShutdownStart
INFO server comment - ServerListenerLoadBalancerListener.onServerShutdownStart
INFO server comment - LoadBalancerServer.handleMessage[2bca3afc-1e4e-46a0-a42c-fca16d1492c7]: status: STOPPED
INFO vhost vhost-stop _defaultVHost_ -
INFO stream unpublish myStream -
INFO stream destroy myStream -
INFO session disconnect 481724622 -
INFO application app-stop _definst_ live/_definst_
INFO server comment - ModuleStreamRecord.onAppStop
INFO server server-stop - -
root@box:/usr/local/WowzaMediaServer/bin# ls
com.wowza.WowzaMediaServer.plist  genkey.sh  shutdown.sh  wms-ant.jar        wms.sh            WowzaMediaServerd
genkey.jar                        setenv.sh  startup.sh   wms-bootstrap.jar  WowzaMediaServer  WowzaMediaServerOSX
root@box:/usr/local/WowzaMediaServer/bin# cd /tmp
root@box:/tmp# ls -la
total 2328
drwxrwxrwt  6 root    root       4096 Jan  3 22:09 .
drwxr-xr-x 21 root    root       4096 Jun  8  2011 ..
drwxr-xr-x  2 randall randall    4096 Dec 28 21:53 hsperfdata_randall
drwxr-xr-x  2 root    root       4096 Jan  3 22:03 hsperfdata_root
drwxrwxrwt  2 root    root       4096 Nov  4 04:47 .ICE-unix
-rw-r--r--  1 root    root    2352752 Jan  3 22:03 mycoolvideo.mp4
drwxrwxrwt  2 root    root       4096 Nov  4 04:47 .X11-unix

Ubuntu is based on Debian, so Ubuntu should work for you.

gabole:

Thanks for the tip about the flash client.

Please provide the following:

  1. The HTTP Provider URL that works.

  2. The HTTP Provider URL that doesn’t work.

  3. Provide the output of “ls -la /[Wowza]/lib”. So I can see what version of LiveStreamRecord you have.

  4. Try the following with an app called live and a streamname called myStream:

http://[Wowza-Server-IP]:1935/livestreamrecord?app=live&streamname=myStream&action=startRecording&format=2&output=/tmp/mycoolvideo.mp4

If it doesn’t work can you provide your console/log output from when you start Wowza and try to record the stream. (Similar to how I did in my previous post).

Thanks.

Well thanks for the detailed information. I was hoping maybe I would see that you were running an old version of Wowza, and that maybe upgrading would fix it. I don’t know what the problem is but I don’t think it’s Ubuntu specific. Is it possible that you haven’t downloaded the LiveStreamRecord_3.0 module in a while? Perhaps the version Richard and I are using has addressed this issue. Maybe you could try re-downloading it.

The only other thing that seems suspicious is in your test #2 you have “output=test.flv” and it’s being recorded in the lib folder. Do you have your property in your Application.xml set to your lib folder?

Can you post your Application.xml from your videorecording app?

What happens when you try the following:

http://[Wowza-Server-IP]:1935/livestreamrecord?app=videorecording&streamname=myStream&action=startRecording&format=2&output=/tmp/mycoolvideo.mp4

I just noticed your StreamType in your Applicaion.xml is set to “default”. That’s for VOD applications. It should be “live-lowlatency”.

Can you explain what you mean by setting it “in the fla app”. You mean this app: LiveStreamRecord_3.0/clientHTTP/HTTPLiveStreamRecord.html?

I don’t think you can change a Wowza application’s StreamType from a flash app. You can only alter an Application.xml (in memory) from a Wowza module. Are you using a custom module?