dji-sdk / Mobile-SDK-iOS

DJI Mobile SDK for iOS: http://developer.dji.com/mobile-sdk/
Other
578 stars 255 forks source link

结合LFLiveKit做推流直播 #405

Open YuhangYang opened 3 years ago

YuhangYang commented 3 years ago
QQ20201118-100100@2x QQ20201118-100043@2x

如图所示,LFLiveKit的pushVideo外部视频是个像素缓存区类型; -(void)videoFeed:(DJIVideoFeed )videoFeed didUpdateVideoData:(NSData )videoData; 获取到的是个data,如何回去到DJIVideoFeed中解析好的pixelBuffer呢???!!!

dji-dev commented 3 years ago

Agent comment from Luce Luo in Zendesk ticket #41174:

尊敬的客户,

您好!感谢您联系DJI 大疆创新。 MSDK不支持获取视频流解码过的CVPixelBufferRef,如果您需要实现直播业务,可以使用官方提供的RTMP方式,示例如下: https://github.com/dji-sdk/Mobile-SDK-iOS/tree/master/Sample%20Code/ObjcSampleCode/DJISdkDemo/Demo/Liveview

非常感谢您的理解与配合,祝您生活愉快!

Best Regards,

DJI 大疆创新SDK技术支持

YuhangYang commented 3 years ago

Agent comment from Luce Luo in Zendesk ticket #41174:

尊敬的客户,

您好!感谢您联系DJI 大疆创新。 MSDK不支持获取视频流解码过的CVPixelBufferRef,如果您需要实现直播业务,可以使用官方提供的RTMP方式,示例如下: https://github.com/dji-sdk/Mobile-SDK-iOS/tree/master/Sample%20Code/ObjcSampleCode/DJISdkDemo/Demo/Liveview

非常感谢您的理解与配合,祝您生活愉快!

Best Regards,

DJI 大疆创新SDK技术支持

1、安卓端直接使用MSDK中的RMTP推流示列,输入推流URL,可以正常直接使用。 2、iOS端直接使用MSDK中的RMTP推流示列,输入推流URL,VideoLiveStreamingViewController.m中的DJIRtmpMuxerState=DJIRtmpMuxerState_prepareIFrame。 3、用UXSDK的DefaultLayoutViewController.m的页面导入MSDK中VideoLiveStreamingViewController.m是的直播推流的代码。运行后,DJIRtmpMuxerState=DJIRtmpMuxerState_Stoped。 大哥知道为什么吗?

randy-Zhang commented 3 years ago

结合LFLiveKit做推流可以调用

- (void)videoProcessFrame:(VideoFrameYUV *)frame { 
    //硬件解码成功
    if (frame->cv_pixelbuffer_fastupload) {
         [self.rtmpManager pushPixelBuffer:frame->cv_pixelbuffer_fastupload];
    }else{
        DDLogError(@"该设备不支持硬解");
    }
}

- (void)pushPixelBuffer:(CVPixelBufferRef)pixelBuffer {
  [self.liveSession pushVideo:pixelBuffer];
}

第一个是DJ的代理方法 在DJIWidgetDJIStreamCommon.h文件下

@protocol VideoFrameProcessor <NSObject>
@required
/**
 * Enables the frame processor
 */
-(BOOL) videoProcessorEnabled;
-(void) videoProcessFrame:(VideoFrameYUV*)frame;

@optional
/*
 * this output frame is not the same frame that input to the decoder
 * this frame only keeps some basic infomations from that input frame
 */
-(void) videoProcessFailedFrame:(VideoFrameH264Raw*)frame;
@end

你可以试试