Firefly开源社区

1234
发表新贴
打印 上一主题 下一主题

[应用开发] ffmedia无法正常调用

98

积分

0

威望

0

贡献

技术小白

积分
98
发表于 2024-3-1 09:08:57        只看该作者  21#
本帖最后由 wuyq 于 2024-3-1 09:18 编辑
dengkx 发表于 2024-2-29 18:49
-d 0 -f out.h265 正常说明拉流解码正常。
编码模块只能处理NV12的数据-b 转换成BGR格式就不要用-e编码 ...


抱歉~~~昨天回复内容写错了,-d 0 -f out.h265 是正常的,无不正常现象;”应该为“-e 0 -f out.h265 是正常的,无不正常现象;”;
以下命令是昨天测试的,结果是-d全屏黑屏,-m文件播放正常。
------20240229 14:39 启动下述命令,【现象】全屏黑屏,输出文件正常可以打开,也有时间进度条。按q退出。
  1. root@firefly:/home/ap/cetccity/wuyiqi/ffmediaTest# python3 demo.py -i 'rtsp://admin:js123456@192.168.8.213:554/cam/realmonitor?channel=1&subtype=0' --rtsp_transport '1' -d '0' -e '0' -m 'out.mp4'
  2. Firefly FFMedia: v2.2.3
  3. input source is a rtsp url
  4. INFO: ff_media: connectToServer: connected to server 192.168.8.213:554
  5. WARN: ff_media: sendOptionsCmd: cannot handle OPTIONS response: RTSP/1.0 401 Unauthorized
  6. ERROR: ff_media: CheckUdpPort: [CheckUdpPort] bind() error (port number: 10000): INFO: ff_media: initiate: Rtp port(10000) already used the other rtp port
  7. ERROR: ff_media: CheckUdpPort: [CheckUdpPort] bind() error (port number: 10002): INFO: ff_media: initiate: Rtp port(10002) already used the other rtp port
  8. INFO: 16ModuleRtspClient: init: rtsp para w h: 1920 1080, ws hs: 1920 1080, format: H265
  9. INFO: 15DrmDisplayPlane: setupDisplayDevice: 0 0
  10. INFO: 15DrmDisplayPlane: setupDisplayDevice: conn_id = 150 enc_id = 149 crtc_id = 71
  11. INFO: 15DrmDisplayPlane: setup: plane_id = 101
  12. ==================Pipe===================
  13. ModuleRtspClient (H265 1920x1080)
  14.    |--->ModuleMppDec (NV12 1920x1080)
  15.            |--->ModuleDrmDisplay (NV12 1920x1080)
  16.            |--->ModuleMppEnc (H264 1920x1080)
  17.                    |--->ModuleFileWriter (Unknow V4L2 Format 0x0)

  18. wait...rga_api version 1.3.0_[0] (RGA is compiling with meson base: $PRODUCT_BASE)
  19. INFO: 16ModuleDrmDisplay: setupWindow: input NV12 0 0 1920 1080 2304 1088
  20. INFO: 16ModuleDrmDisplay: setupWindow: output NV12 0 0 1920 1080 1920 1080
  21. INFO: 10MppDecoder: getTimeoutSample: 0x19225120 frame info changed 1 error 0 discard 0
  22. INFO: 10MppEncoder: putWithBuffers: Input frame para is changed, redo init
  23. q
  24. ==================Summary================
  25. ModuleRtspClient (In Full: 0, Out Empty: 224)
  26.    |--->ModuleMppDec (In Full: 0, Out Empty: 415)
  27.            |--->ModuleDrmDisplay (In Full: 0, Out Empty: 0)
  28.            |--->ModuleMppEnc (In Full: 0, Out Empty: 221)
  29.                    |--->ModuleFileWriter (In Full: 0, Out Empty: 0)

  30. INFO: 10RTSPClient: teardownMediaSession: teardown session success
复制代码

回复

使用道具 举报

818

积分

0

威望

0

贡献

技术大神

Rank: 3Rank: 3

积分
818
发表于 2024-3-1 09:43:52        只看该作者  22#
wuyq 发表于 2024-3-1 09:08
抱歉~~~昨天回复内容写错了,“-d 0 -f out.h265 是正常的,无不正常现象;”应该为“-e 0 -f out.h265 ...

你可以按照我提供的操作来吗?
-d 0 -f out.h265
看到显示黑屏后等几秒退出,你就可以用你win软件播放该文件看rtsp拉流的数据正不正常。
不用关注进度条,-f是直接将源模块(rtsp)输出的数据写入文件,他是裸流,没有时间戳不会有进度条;-m封装mp4、mkv、flv、ts等封装格式文件才有时间戳才会有进度条
回复

使用道具 举报

98

积分

0

威望

0

贡献

技术小白

积分
98
发表于 2024-3-1 09:58:36        只看该作者  23#
本帖最后由 wuyq 于 2024-3-1 14:02 编辑
dengkx 发表于 2024-3-1 09:43
你可以按照我提供的操作来吗?
-d 0 -f out.h265
看到显示黑屏后等几秒退出,你就可以用你win软件播放 ...

按照您说的,操作如下~
-----20240301 09:50 【现象】-d 0 盒子上全屏黑屏,-f out.h256 win环境播放正常。
  1. root@firefly:/home/ap/cetccity/wuyiqi/ffmediaTest# python3 demo.py -i 'rtsp://admin:js123456@192.168.8.213:554/cam/realmonitor?channel=1&subtype=0' -d '0' -f 'out.h265'
  2. Firefly FFMedia: v2.2.3
  3. input source is a rtsp url
  4. INFO: ff_media: connectToServer: connected to server 192.168.8.213:554
  5. WARN: ff_media: sendOptionsCmd: cannot handle OPTIONS response: RTSP/1.0 401 Unauthorized
  6. INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)
  7. INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)
  8. INFO: 16ModuleRtspClient: init: rtsp para w h: 1920 1080, ws hs: 1920 1080, format: H265
  9. INFO: 15DrmDisplayPlane: setupDisplayDevice: 0 0
  10. INFO: 15DrmDisplayPlane: setupDisplayDevice: conn_id = 150 enc_id = 149 crtc_id = 71
  11. INFO: 15DrmDisplayPlane: setup: plane_id = 101
  12. ==================Pipe===================
  13. ModuleRtspClient (H265 1920x1080)
  14.    |--->ModuleMppDec (NV12 1920x1080)
  15.            |--->ModuleDrmDisplay (NV12 1920x1080)

  16. wait...rga_api version 1.3.0_[0] (RGA is compiling with meson base: $PRODUCT_BASE)
  17. INFO: 16ModuleDrmDisplay: setupWindow: input NV12 0 0 1920 1080 2304 1088
  18. INFO: 16ModuleDrmDisplay: setupWindow: output NV12 0 0 1920 1080 1920 1080
  19. INFO: 10MppDecoder: getTimeoutSample: 0x2e49f6a0 frame info changed 1 error 0 discard 0
  20. q
  21. ==================Summary================
  22. ModuleRtspClient (In Full: 0, Out Empty: 109)
  23.    |--->ModuleMppDec (In Full: 0, Out Empty: 103)
  24.            |--->ModuleDrmDisplay (In Full: 0, Out Empty: 0)

  25. INFO: 10RTSPClient: teardownMediaSession: teardown session success
复制代码

这边的需求是希望通过demo.py中的cv2_extcall_bac方法,
获取第54行的img = data.reshape((vb.getImagePara().vstride, vb.getImagePara().hstride, 3)),
然后对img进行图像算法处理。
然后目前尝试过-c 1无效,然后排错就出现了-d 0、-x 1显示不行问题~~~


回复

使用道具 举报

98

积分

0

威望

0

贡献

技术小白

积分
98
发表于 2024-3-3 09:45:03        只看该作者  24#
wuyq 发表于 2024-3-1 09:58
按照您说的,操作如下~
-----20240301 09:50 【现象】-d 0 盒子上全屏黑屏,-f out.h256 win环境播放正 ...

该【现象】-d 0 盒子上全屏黑屏,-f out.h256 win环境播放正常。
是否可以认为是ffmedia屏幕输出有问题,生成的out.h256是正常的?
打印cv2_extcall_bac方法中str(MediaBuffer.getActiveData())是[0,0,0,....,0]。
回复

使用道具 举报

818

积分

0

威望

0

贡献

技术大神

Rank: 3Rank: 3

积分
818
发表于 2024-3-4 10:34:10        只看该作者  25#
wuyq 发表于 2024-3-3 09:45
该【现象】-d 0 盒子上全屏黑屏,-f out.h256 win环境播放正常。
是否可以认为是ffmedia屏幕输出有问题 ...

这问题看着像是rga的问题。再试试这两个命令, -i输入本地视频文件也行:
./demo.py -i rtsp://xxxx - e 0 -m out1.mp4
./demo.py -i xxxx -o 1280x720 -e 0 -m out2.mp4

执行十几秒再按回车键退出,在win播放这两个文件看哪个有异常。
回复

使用道具 举报

98

积分

0

威望

0

贡献

技术小白

积分
98
发表于 2024-3-4 11:33:26        只看该作者  26#
本帖最后由 wuyq 于 2024-3-4 11:35 编辑
dengkx 发表于 2024-3-4 10:34
这问题看着像是rga的问题。再试试这两个命令, -i输入本地视频文件也行:
./demo.py -i rtsp://xxxx - e  ...

按照要求测试结果:
~~结论~~
① rtsp mp4文件播放正常。
② 找了2段mp4本地文件,执行后 新的mp4文件均绿屏。

~~详细命令行~~
------20240304 11:20 out1.mp4【打开正常】
  1. root@firefly:/home/ap/cetccity/wuyiqi/ffmediaTest# python3 demo.py -i 'rtsp://admin:js123456@192.168.8.213:554/cam/realmonitor?channel=1&subtype=0' -e '0' -m 'out1.mp4'
  2. Firefly FFMedia: v2.2.3
  3. input source is a rtsp url
  4. INFO: ff_media: connectToServer: connected to server 192.168.8.213:554
  5. WARN: ff_media: sendOptionsCmd: cannot handle OPTIONS response: RTSP/1.0 401 Unauthorized
  6. INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)
  7. INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)
  8. INFO: 16ModuleRtspClient: init: rtsp para w h: 1920 1080, ws hs: 1920 1080, format: H265
  9. ==================Pipe===================
  10. ModuleRtspClient (H265 1920x1080)
  11.    |--->ModuleMppDec (NV12 1920x1080)
  12.            |--->ModuleMppEnc (H264 1920x1080)
  13.                    |--->ModuleFileWriter (Unknow V4L2 Format 0x0)

  14. wait...INFO: 10MppDecoder: getTimeoutSample: 0x5ea22a0 frame info changed 1 error 0 discard 0
  15. INFO: 10MppEncoder: putWithBuffers: Input frame para is changed, redo init
  16. q
  17. ==================Summary================
  18. ModuleRtspClient (In Full: 0, Out Empty: 479)
  19.    |--->ModuleMppDec (In Full: 0, Out Empty: 458)
  20.            |--->ModuleMppEnc (In Full: 0, Out Empty: 461)
  21.                    |--->ModuleFileWriter (In Full: 0, Out Empty: 0)

  22. INFO: 10RTSPClient: teardownMediaSession: teardown session success
复制代码

------20240304 11:22 out2.mp4【打开不正常】
  1. root@firefly:/home/ap/cetccity/wuyiqi/ffmediaTest# python3 demo.py -i 'yanhuo.mp4' -o '1280x720' -e '0' -m 'out2.mp4'
  2. Firefly FFMedia: v2.2.3
  3. input source is a regular file.
  4. INFO: 16ModuleFileReader: init: Get Video Resolution( 2560 x 1436 )
  5. rga_api version 1.3.0_[0] (RGA is compiling with meson base: $PRODUCT_BASE)
  6. ==================Pipe===================
  7. ModuleFileReader (H264 2560x1436)
  8.    |--->ModuleMppDec (NV12 2560x1436)
  9.            |--->ModuleRga (NV12 1280x720)
  10.                    |--->ModuleMppEnc (H264 1280x720)
  11.                            |--->ModuleFileWriter (Unknow V4L2 Format 0x0)

  12. wait...INFO: 10MppDecoder: getTimeoutSample: 0x8ba7d20 frame info changed 1 error 0 discard 0
  13. INFO: 16ModuleFileReader: work: Produce EOS
  14. ERROR: 16ModuleFileWriter: work: wait for productor ModuleMppEnc timeout
  15. q
  16. ==================Summary================
  17. ModuleFileReader (In Full: 0, Out Empty: 49)
  18.    |--->ModuleMppDec (In Full: 1720, Out Empty: 8)
  19.            |--->ModuleRga (In Full: 200, Out Empty: 508)
  20.                    |--->ModuleMppEnc (In Full: 14, Out Empty: 863)
  21.                            |--->ModuleFileWriter (In Full: 0, Out Empty: 0)
复制代码

------20240304 11:26 out3.mp4【打开不正常】
  1. root@firefly:/home/ap/cetccity/wuyiqi/ffmediaTest# python3 demo.py -i 'mj.mp4' -o '1280x720' -e '0' -m 'out3.mp4'
  2. Firefly FFMedia: v2.2.3
  3. input source is a regular file.
  4. INFO: 16ModuleFileReader: init: Get Video Resolution( 540 x 960 )
  5. rga_api version 1.3.0_[0] (RGA is compiling with meson base: $PRODUCT_BASE)
  6. ==================Pipe===================
  7. ModuleFileReader (H264 540x960)
  8.    |--->ModuleMppDec (NV12 540x960)
  9.            |--->ModuleRga (NV12 1280x720)
  10.                    |--->ModuleMppEnc (H264 1280x720)
  11.                            |--->ModuleFileWriter (Unknow V4L2 Format 0x0)

  12. wait...INFO: 10MppDecoder: getTimeoutSample: 0x4f998e0 frame info changed 1 error 0 discard 0
  13. INFO: 16ModuleFileReader: work: Produce EOS
  14. ERROR: 16ModuleFileWriter: work: wait for productor ModuleMppEnc timeout
  15. q
  16. ==================Summary================
  17. ModuleFileReader (In Full: 0, Out Empty: 434)
  18.    |--->ModuleMppDec (In Full: 355, Out Empty: 7)
  19.            |--->ModuleRga (In Full: 212, Out Empty: 7)
  20.                    |--->ModuleMppEnc (In Full: 339, Out Empty: 347)
  21.                            |--->ModuleFileWriter (In Full: 0, Out Empty: 0)
复制代码
回复

使用道具 举报

818

积分

0

威望

0

贡献

技术大神

Rank: 3Rank: 3

积分
818
发表于 2024-3-4 11:41:19        只看该作者  27#
wuyq 发表于 2024-3-4 11:33
按照要求测试结果:
~~结论~~
① rtsp mp4文件播放正常。

第二条命令也可以测下rtsp,不过大概知道问题了,是rga模块无法正常运行,可以更新最新的发布的固件测试下
回复

使用道具 举报

98

积分

0

威望

0

贡献

技术小白

积分
98
发表于 2024-3-4 13:41:51        只看该作者  28#
本帖最后由 wuyq 于 2024-3-4 13:53 编辑
dengkx 发表于 2024-3-4 11:41
第二条命令也可以测下rtsp,不过大概知道问题了,是rga模块无法正常运行,可以更新最新的发布的固件测试 ...

目前我们的盒子版本是rk3568pc-se。可以使用以下固件地址吗?【https://www.t-firefly.com/doc/download/180.html -> 固件 -> Ubuntu ->Ubuntu20.04 -> Public -> ROC-RK3568-PC-SE_Ubuntu20.04-r3108_v1.3.2g_240111.7z】
回复测试情况~
------20240304 13:35 out4.mp4【打开不正常】
  1. root@firefly:/home/ap/cetccity/wuyiqi/ffmediaTest# python3 demo.py -i 'rtsp://admin:js123456@192.168.8.213:554/cam/realmonitor?channel=1&subtype=0' -o '1280x720' -e '0' -m 'out4.mp4'
  2. Firefly FFMedia: v2.2.3
  3. input source is a rtsp url
  4. INFO: ff_media: connectToServer: connected to server 192.168.8.213:554
  5. WARN: ff_media: sendOptionsCmd: cannot handle OPTIONS response: RTSP/1.0 401 Unauthorized
  6. INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)
  7. INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)
  8. INFO: 16ModuleRtspClient: init: rtsp para w h: 1920 1080, ws hs: 1920 1080, format: H265
  9. rga_api version 1.3.0_[0] (RGA is compiling with meson base: $PRODUCT_BASE)
  10. ==================Pipe===================
  11. ModuleRtspClient (H265 1920x1080)
  12.    |--->ModuleMppDec (NV12 1920x1080)
  13.            |--->ModuleRga (NV12 1280x720)
  14.                    |--->ModuleMppEnc (H264 1280x720)
  15.                            |--->ModuleFileWriter (Unknow V4L2 Format 0x0)

  16. wait...INFO: 10MppDecoder: getTimeoutSample: 0x2b00f360 frame info changed 1 error 0 discard 0
  17. q
  18. ==================Summary================
  19. ModuleRtspClient (In Full: 0, Out Empty: 309)
  20.    |--->ModuleMppDec (In Full: 0, Out Empty: 296)
  21.            |--->ModuleRga (In Full: 0, Out Empty: 295)
  22.                    |--->ModuleMppEnc (In Full: 0, Out Empty: 296)
  23.                            |--->ModuleFileWriter (In Full: 0, Out Empty: 0)

  24. INFO: 10RTSPClient: teardownMediaSession: teardown session success
复制代码

回复

使用道具 举报

818

积分

0

威望

0

贡献

技术大神

Rank: 3Rank: 3

积分
818
发表于 2024-3-4 13:53:32        只看该作者  29#
wuyq 发表于 2024-3-4 13:41
固件地址可以提供下吗?目前我们的盒子版本是rk3568pc-se。
回复测试情况~
------20240304 13:35 out4. ...

https://www.t-firefly.com/doc/download/180.html
可以在这个页面选择你要下载的固件下载
回复

使用道具 举报

98

积分

0

威望

0

贡献

技术小白

积分
98
发表于 2024-3-4 15:49:23        只看该作者  30#
本帖最后由 wuyq 于 2024-3-4 15:59 编辑
dengkx 发表于 2024-3-4 13:53
https://www.t-firefly.com/doc/download/180.html
可以在这个页面选择你要下载的固件下载

最新的发布的固件测试下,我找到的是一下固件版本
固件版本ROC-RK3568-PC-SE_Ubuntu20.04-r3108_v1.3.2g_240111.7z
此固件自带python38
参照ffmedia_release/demo/readme.md安装apt组件
运行以下命令出现的情况~
总结
-e 0 -f out.h256 文件在win环境播放正常
-e 0 -o 1280*720 -x 1 绿屏

------20240304 15:00 【现象】绿屏无法展示
  1. root@firefly:/home/ap/cetccity/wuyiqi/ffmediaTest# python3 demo.py -i 'rtsp://admin:js123456@192.168.8.213:554/cam/realmonitor?channel=1&subtype=0' -e '0' -o '1280*720' -x '1'
  2. Firefly FFMedia: v2.2.3
  3. input source is a rtsp url                                                                                                                                                                  
  4. INFO: ff_media: connectToServer: connected to server 192.168.8.213:554                                                                                                                       
  5. WARN: ff_media: sendOptionsCmd: cannot handle OPTIONS response: RTSP/1.0 401 Unauthorized                                                                                                   
  6. ERROR: ff_media: CheckUdpPort: [CheckUdpPort] bind() error (port number: 10000): INFO: ff_media: initiate: Rtp port(10000) already used the other rtp port                                   
  7. ERROR: ff_media: CheckUdpPort: [CheckUdpPort] bind() error (port number: 10002): INFO: ff_media: initiate: Rtp port(10002) already used the other rtp port                                   
  8. INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)                                                                                                                           
  9. INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)                                                                                                                           
  10. INFO: 16ModuleRtspClient: init: rtsp para w h: 1920 1080, ws hs: 1920 1080, format: H265                                                                                                     
  11. rga_api version 1.3.0_[0] (RGA is compiling with meson base: $PRODUCT_BASE)                                                                                                                  
  12. ==================Pipe===================                                                                                      
复制代码







回复

使用道具 举报

返回列表
1234
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

友情链接 : 爱板网 电子发烧友论坛 云汉电子社区 粤ICP备14022046号-2
快速回复 返回顶部 返回列表