RTSP流怎么录制

大牛直播录像SDK可作为单独功能模块使用(如同时多路录像存档),亦分布于以下模块,和其他模块组合调用

  1. windows/android/iOS推送端SDK Demo;
  2. windows/android/iOS播放端SDK Demo;

大牛直播录像SDK不同于普通录像接口,更智能,和推送、播放、转发、内置轻量级RTSP服务功能完全分离,支持随时录像

此外,大牛直播录像SDK在录像过程中,支持切换不同URL,如两个URL配置一致,则可以录制到同一个MP4文件,如不一致,可自动分割到下一个文件。

此外,大牛直播录像SDK支持设置单个录像文件大小、录像路径等,并支持纯音频、纯视频、音视频录制模式。

从开始录像,到录像结束均有event callback上来,网络堵塞、音视频同步均做了非常友好的处理,大牛直播录像SDK是目前市面上为数不多真正好用的商业化录像SDK。

相关接口实现:

Windows平台:

		/*
		设置本地录像目录, 必须是英文目录,否则会失败
		*/
		NT_UINT32(NT_API *SetRecorderDirectory)(NT_HANDLE handle, NT_PCSTR dir);

		/*
		设置单个录像文件最大大小, 当超过这个值的时候,将切割成第二个文件
		size: 单位是KB(1024Byte), 当前范围是 [5MB-800MB], 超出将被设置到范围内
		*/
		NT_UINT32(NT_API *SetRecorderFileMaxSize)(NT_HANDLE handle, NT_UINT32 size);

		/*
		设置录像文件名生成规则
		*/
		NT_UINT32(NT_API *SetRecorderFileNameRuler)(NT_HANDLE handle, NT_SP_RecorderFileNameRuler* ruler);


		/*
		设置录像回调接口
		*/
		NT_UINT32(NT_API *SetRecorderCallBack)(NT_HANDLE handle,
			NT_PVOID call_back_data, SP_SDKRecorderCallBack call_back);

		/*
		启动录像
		*/
		NT_UINT32(NT_API *StartRecorder)(NT_HANDLE handle);

		/*
		停止录像
		*/
		NT_UINT32(NT_API *StopRecorder)(NT_HANDLE handle);

Android平台:

	/**
	 * Create file directory
	 *
	 * @param path,  E.g: /sdcard/daniulive/rec
	 *
	 * <pre> The interface is only used for recording the stream data to local side. </pre>
	 *
	 * @return {0} if successful
	 */
	public native int SmartPlayerCreateFileDirectory(String path);

	/**
	 * Set recorder directory.
	 *
	 * @param path: the directory of recorder file.
	 *
	 * <pre> NOTE: make sure the path should be existed, or else the setting failed. </pre>
	 *
	 * @return {0} if successful
	 */
	public native int SmartPlayerSetRecorderDirectory(long handle, String path);

	/**
	 * Set the size of every recorded file.
	 *
	 * @param size: (MB), (5M~500M), if not in this range, set default size with 200MB.
	 *
	 * @return {0} if successful
	 */
	public native int SmartPlayerSetRecorderFileMaxSize(long handle, int size);

	/**
	 * Start recorder stream
	 *
	 * @param handle: return value from SmartPlayerOpen()
	 *
	 * @return {0} if successful
	 */
	public native int SmartPlayerStartRecorder(long handle);

	/**
	 * Stop recorder stream
	 *
	 * @param handle: return value from SmartPlayerOpen()
	 *
	 * @return {0} if successful
	 */
	public native int SmartPlayerStopRecorder(long handle);

iOS平台:

/**
 * 录像相关:
 *
 * @param path 录像文件存放目录
 *
 * @return {0} if successful
 */
- (NSInteger)SmartPlayerSetRecorderDirectory:(NSString*)path;

/**
 * 录像相关:
 *
 * @param size 每个录像文件的大小 (5~500M), 默认200M
 *
 * @return {0} if successful
 */
- (NSInteger)SmartPlayerSetRecorderFileMaxSize:(NSInteger)size;

/**
 * 录像相关:
 *
 * Start recorder(开始录像)
 *
 * @return {0} if successful
 */
- (NSInteger)SmartPlayerStartRecorder;

/**
 * 录像相关:
 *
 * Stop recorder(停止录像)
 *
 * @return {0} if successful
 */
- (NSInteger)SmartPlayerStopRecorder;

参考资料:

daniulive/SmarterStreaming

猜你喜欢

转载自blog.csdn.net/renhui1112/article/details/81175821