• SEARCH
  • DOWNLOADS
  • MY ACCOUNT
  • Buy (0)
  • CONTACT
  • Free Trial
Wowza Logo
  • PRODUCTS
  • DEVELOPER
  • SOLUTIONS
  • PRICING
  • RESOURCES
  • SUPPORT
  • My Account
  • Buy (0)
  • SEARCH
  • Ask a question
  • Forums
    • Wowza ClearCaster
    • Wowza Streaming Engine
    • Wowza Streaming Cloud
    • Wowza Player
    • Wowza GoCoder SDK
    • Wowza Developer Dojo
    • Topics
    • Questions
    • Articles
    • Users
    • Badges
  • Sign in
  • Community Home /
  • Wowza Developer Dojo /
  • Wowza Streaming Server Java API /
avatar image
Question by Mike O'Rourke · Feb 27, 2014 at 02:02 PM · wowza streaming server java api

Record stream from command line

Hi.

I am running WowzaStreamingEngine 4.0.0 on a Solaris box. I want to set cron jobs to start and stop streams and recordings.

The part about starting and stopping streams works fine with the JMXCommandLine tool.

The recording part is proving to be a little bit harder. Is the LiveStreamRecordManager module usable from the JMX interface?

I do not want to use the AutoRecord since I want to bring the stream up about 10 to 15 minutes before I start the recording and stop it before I stop the stream.

I have attempted to modify JMXCommandLine.java and here is a diff output of my modifications to JMXCommandLine.java (I called the new file WowzaCTRL.java to keep things separate):

5c5

< public class JMXCommandLine

---

> public class WowzaCTRL

47a48,50

> public static final String CMD_STARTRECORDING = "startRecording";

> public static final String CMD_STOPRECORDING = "stopRecording";

>

158a162,164

> System.out.println(" "+CMD_STARTRECORDING+" [vhost:application/appInstance] [stream-name] [filename]");

> System.out.println(" "+CMD_STOPRECORDING+" [vhost:application/appInstance] [stream-name]");

>

518a523,553

> else if (args[argOffset].equalsIgnoreCase(CMD_STARTRECORDING))

> {

> System.out.println(args[argOffset]+" "+args[argOffset+1]+" "+args[argOffset+2]+" "+args[argOffset+3]);

>

> AppConextName context = new AppConextName(args[argOffset+1], true);

>

> String connectsName = MBEANNAME+":vHosts=VHosts,vHostName="+context.vhostName+",applications=Applications,applicationName="+context.appName+",applicationInstances=ApplicationInstances,applicationInstanceName="+context.appInstName+",name=ApplicationInstance";

> ObjectName connectsObjName = new ObjectName(connectsName);

> StreamRecorderParameters recordParams = new StreamRecorderParameters(connectsName);

> recordParams.segmentationType = IStreamRecorderConstants.SEGMENT_NONE;

> recordParams.versioningOption = IStreamRecorderConstants.OVERWRITE_FILE;

> recordParams.fileFormat = IStreamRecorderConstants.FORMAT_MP4;

> recordParams.outputFile = args[argOffset+3];

>

> Object[] arguments = {args[argOffset+1], args[argOffset+2], recordParams};

> String[] signature = {"java.lang.String", "java.lang.String", "java.lang.Object"};

> doInvoke(connection, connectsObjName, "ILiveStreamRecordManager.startRecording", arguments, signature);

> }

> else if (args[argOffset].equalsIgnoreCase(CMD_STOPRECORDING))

> {

> System.out.println(args[argOffset]+" "+args[argOffset+1]+" "+args[argOffset+2]);

>

> AppConextName context = new AppConextName(args[argOffset+1], true);

>

> String connectsName = MBEANNAME+":vHosts=VHosts,vHostName="+context.vhostName+",applications=Applications,applicationName="+context.appName+",applicationInstances=ApplicationInstances,applicationInstanceName="+context.appInstName+",name=ApplicationInstance";

> ObjectName connectsObjName = new ObjectName(connectsName);

>

> Object[] arguments = {args[argOffset+1], args[argOffset+2]};

> String[] signature = {"java.lang.String"};

> doInvoke(connection, connectsObjName, "ILiveStreamRecordManager.stopRecording", arguments, signature);

> }

When I try to compile this, the first problem is the argument I use in the "new StreamRecorderParameters()" function (connectsName).

The compiler complains with an "error: cannot find symbol" with a carat under the "e" in "connectsName".

Another cannot find symbol error puts the carat under the "S" in the second "StreamRecorderParamaters" of that same command.

Finally, there are 3 cannot find symbol errors concerning the "IStreamRecorderConstants" lines.

My first problem (and perhaps solution to the others) is: what argument do I supply for the "new StreamRecorderParameters()" function; since I am not actually in any appInstance yet, I cannot use "this.appInstance"; I need to supply a name.

If the LiveStreamRecordManager module is ultimately not accessible from the JMX utility, I guess I will have to use telnet to send http commands, which is not nearly as elegant as using the JMXCommandLine, but would work.

Thanks.

Mike.
Comment

People who like this

0 Show 0
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by Roger Littin · Feb 28, 2014 at 10:58 AM

Hi Mike,

The way JMX works, you can only send and receive simple values or Objects that are marked as Serializable. ApplicationInstance is not Serializable so you cannot send and receive it using JMX.

For what you are wanting to do, I would suggest creating a simple module that wraps the methods you want to use and make those wrappers available to the JMX interface. Any public methods that only receive or return simple values or do not need or return a value are automatically added to the mbeans for the module instance and will be available via JMX. AppInstances do need to be running for the module instance mbeans to be visible. You can call one of the VHost. touchApplicationInstance methods via JMX to load the appInstance prior to calling your methods

You will then be able to add methods to your JMX class that will work with your wrapper methods.

The reason you are probably getting the compile errors is because you don't have the Wowza classes available in your class path when compiling. Because you are building something to communicate remotely with wowza then you shouldn't be compiling against the Wowza classes anyway as these will most likely not be available at runtime anyway.

Roger.
Comment

People who like this

0 Show 0 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

On the fly starting a rtsp stream when a client connects 6 Answers

Question about server-side playlist playback 4 Answers

NEED HELP finding the right module for creating playlist based streams! 4 Answers

Determine live stream delay 1 Answer

HTTPProvider works from Eclipse, not from .JAR 2 Answers

Hot Topics
  • AWS Hosting
  • Mobile SDK
  • Deployment Options
  • Load Balancing
  • Content Security
Product Sign-in
  • Wowza Streaming Cloud
  • Wowza Player
Under the Hood
  • Developer Tools
  • Wowza System Status
  • Test Players
  • Developer IDE
Resellers
  • Find a Reseller
  • Reseller Portal
  • Become a Reseller
Company
  • About Us
  • Blog
  • News
  • Events
  • Careers
  • Customers
  • Partners
  • Contact Us
Stay Connected
Get Monthly Newsletter
Select a Language
  • English
    • English
    • Español
    • 日本語
    • 한국어
    • हिन्दी भाषा
    • 中文
    • русский язык

© 2005–2019 Wowza Media Systems, LLC. All rights reserved.   Terms | Privacy | Trademarks | Legal


Enterprise
Social Q&A

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Forums
  • Wowza ClearCaster
  • Wowza Streaming Engine
  • Wowza Streaming Cloud
  • Wowza Player
  • Wowza GoCoder SDK
  • Wowza Developer Dojo
  • Explore
  • Topics
  • Questions
  • Articles
  • Users
  • Badges