jjm2473 / ffmpeg-rk

支持rockchip mpp硬件加速编解码的ffmpeg版本。Forked ffmpeg that supports rkmpp decodeing, encoding and rga scaling
https://ffmpeg.org
Other
178 stars 31 forks source link

滤波器/兼容性问题 #23

Closed 1265775896 closed 9 months ago

1265775896 commented 1 year ago

原本可以正常使用的软解命令 ffmpeg -f alsa -i hw:5 \ -f v4l2 -i /dev/video1 \ -c:v libx264 -preset ultrafast -tune fastdecode -maxrate 6000k -bufsize 6000k \ -s 1920x1080 -r 60 \ -c:a aac -b:a 320k \ -f mpegts 'srt://localhost:1936?streamid=input/live/test'

修改libx264为h264_rkmpp后报错 Impossible to convert between the formats supported by the filter 'scaler_out_0_0' and the filter 'auto_scale_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented

继续删除所有参数 或者 添加 -vf "scale=1920:1080" 等尝试 ffmpeg -f alsa -i hw:5 \ -f v4l2 -i /dev/video1 \ -c:v h264_rkmpp \ -c:a aac -b:a 320k \ -f mpegts 'srt://localhost:1936?streamid=input/live/test'

均报错 Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented

qiuxuewen commented 1 year ago

scale 改为 scale_rga试下

1265775896 commented 1 year ago

scale 改为 scale_rga试下

修改指令为 ffmpeg -f alsa -i hw:5 -f v4l2 -i /dev/video1 -vf 'scale_rga' -c:v h264_rkmpp -preset ultrafast -tune film -minrate 1000k -maxrate 6000k -bufsize 6000k -c:a aac -b:a 320k -f mpegts -pix_fmt yuvj422p 'rtmp://localhost:1935/test/test'

现在报错 [scale_rga @ 0xaaab1740cf10] RGA failed (code = -22) Error while filtering: Invalid argument Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #1:0

警告有 Incompatible pixel format 'yuvj422p' for codec 'h264_rkmpp', auto-selecting format 'drm_prime' [swscaler @ 0xaaaac1ede7a0] [swscaler @ 0xaaaac2108790] deprecated pixel format used, make sure you did set range correctly

1265775896 commented 1 year ago

补充 重新编译后相同命令可以执行了 但是 丢失了很多像素 时间戳问题 警告 [mpegts @ 0xaaaac93768f0] Invalid DTS: 312189000 PTS: 18000 in output stream 0:0, replacing by guess 但是 在我重新启动以后 神奇的又无法执行了 重新编译也未能解决问题 完整日志 Input #0, alsa, from 'hw:5': Duration: N/A, start: 1692354817.397006, bitrate: 1536 kb/s Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s Input #1, video4linux2,v4l2, from '/dev/video1': Duration: N/A, start: 1012.425018, bitrate: N/A Stream #1:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 60 fps, 60 tbr, 1000k tbn

Stream mapping: Stream #1:0 -> #0:0 (mjpeg (native) -> h264 (h264_rkmpp)) Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native)) Press [q] to stop, [?] for help

[swscaler @ 0xaaaadde79d20] [swscaler @ 0xaaaadde87f00] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0xaaaadde79d20] [swscaler @ 0xaaaaddee0450] deprecated pixel format used, make sure you did set range correctly [swscaler @ 0xaaaadde79d20] [swscaler @ 0xaaaaddf385c0] deprecated pixel format used, make sure you did set range correctly ......

rgaapi version 1.9.3[0] RgaBlit(1465) RGA_BLIT fail: Invalid argument RgaBlit(1466) RGA_BLIT fail: Invalid argument handl-fd-vir-phy-hnd-format[0, 0, 0xffff8c364010, (nil), 0, 0] rect[0, 0, 1920, 1080, 1920, 1080, 2816, 0] f-blend-size-rotation-col-log-mmu[0, 0, 0, 0, 0, 0, 1] handl-fd-vir-phy-hnd-format[0, 9, (nil), (nil), 0, 0] rect[0, 0, 1920, 1080, 1920, 1080, 2560, 3110400] f-blend-size-rotation-col-log-mmu[0, 0, 0, 0, 0, 0, 1] This output the user parameters when rga call blit fail [scale_rga @ 0xaaaadde77a60] RGA failed (code = -22) Error while filtering: Invalid argument Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #1:0

jjm2473 commented 10 months ago

看看内核dmesg有没有RGA相关的报错。还有,先按照wiki的方式看看能不能转码保存成文件 https://github.com/jjm2473/ffmpeg-rk/wiki/%E7%BC%96%E8%A7%A3%E7%A0%81-%7C-Transcoding

jjm2473 commented 9 months ago

不要使用 -pix_fmt yuvj422p,h264_rkmpp 只支持nv12或者yuv420p,使用-pix_fmt可能导致软件转换,性能低下