Scaling affects color output #16

Closed
opened 2025-12-23 10:30:31 +01:00 by backuprepo · 2 comments
Owner

Originally created by @jagheterfredrik on GitHub (Feb 9, 2024).

Hello, thank you for your effort on this 👍
I'm trying to do hardware scaling -vf realtime,scale_rkrga=w=1280:h=720:format=yuv420p,hwmap=mode=read,format=yuv420p -r 5 -f rawvideo but my image turns all weird. Without the w/h (-vf realtime,scale_rkrga=format=yuv420p,hwmap=mode=read,format=yuv420p -r 5 -f rawvideo) the video looks fine.

Screenshot 2024-02-10 at 00 47 50

Full ffmpeg is

ffmpeg -threads 2 -hwaccel rkmpp -hwaccel_output_format drm_prime -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://127.0.0.1:8554/front -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac /tmp/cache/framsida@%Y%m%d%H%M%S%z.mp4 -vf realtime,scale_rkrga=w=1280:h=720:format=yuv420p,hwmap=mode=read,format=yuv420p -r 5 -f rawvideo -y pipe:

Input format is

Input #0, rtsp, from 'rtsp://....':
  Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1920x1080, 15 fps, 30 tbr, 90k tbn
  Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_rkmpp) -> rawvideo (native))

Any pointers are highly appreciated 🙏

Originally created by @jagheterfredrik on GitHub (Feb 9, 2024). Hello, thank you for your effort on this 👍 I'm trying to do hardware scaling `-vf realtime,scale_rkrga=w=1280:h=720:format=yuv420p,hwmap=mode=read,format=yuv420p -r 5 -f rawvideo` but my image turns all weird. Without the w/h (`-vf realtime,scale_rkrga=format=yuv420p,hwmap=mode=read,format=yuv420p -r 5 -f rawvideo`) the video looks fine. <img width="1441" alt="Screenshot 2024-02-10 at 00 47 50" src="https://github.com/nyanmisaka/ffmpeg-rockchip/assets/253493/b1a4adec-7fe6-4ed5-bb41-f91589a0fa11"> Full ffmpeg is ``` ffmpeg -threads 2 -hwaccel rkmpp -hwaccel_output_format drm_prime -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://127.0.0.1:8554/front -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac /tmp/cache/framsida@%Y%m%d%H%M%S%z.mp4 -vf realtime,scale_rkrga=w=1280:h=720:format=yuv420p,hwmap=mode=read,format=yuv420p -r 5 -f rawvideo -y pipe: ``` Input format is ``` Input #0, rtsp, from 'rtsp://....': Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1920x1080, 15 fps, 30 tbr, 90k tbn Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s Stream mapping: Stream #0:0 -> #0:0 (h264 (h264_rkmpp) -> rawvideo (native)) ``` Any pointers are highly appreciated 🙏
Author
Owner

@nyanmisaka commented on GitHub (Feb 10, 2024):

@jagheterfredrik
I can't reproduce your issue. Please dump the rawvideo as file and check with the YUView tool.

ffmpeg -hwaccel rkmpp -hwaccel_output_format drm_prime -i INPUT -an -sn \
-vf scale_rkrga=format=yuv420p:w=1280:h=720,hwmap=mode=read,format=yuv420p \
-f rawvideo -vframes 500 -y /tmp/out.yuv

image

@nyanmisaka commented on GitHub (Feb 10, 2024): @jagheterfredrik I can't reproduce your issue. Please dump the rawvideo as file and check with the [YUView tool](https://github.com/IENT/YUView). ```console ffmpeg -hwaccel rkmpp -hwaccel_output_format drm_prime -i INPUT -an -sn \ -vf scale_rkrga=format=yuv420p:w=1280:h=720,hwmap=mode=read,format=yuv420p \ -f rawvideo -vframes 500 -y /tmp/out.yuv ``` ![image](https://github.com/nyanmisaka/ffmpeg-rockchip/assets/14953024/d5f37379-ecee-4a8c-abc8-b8d7c54633ea)
Author
Owner

@jagheterfredrik commented on GitHub (Feb 10, 2024):

Thanks a bunch for the pointer to YUView! It's being displayed in the wrong resolution (1920x1080) and therefore not showing correctly. At the right size it shows fine after scaling. Thank you again for your work on ffmpeg+rockchip 👍

@jagheterfredrik commented on GitHub (Feb 10, 2024): Thanks a bunch for the pointer to YUView! It's being displayed in the wrong resolution (1920x1080) and therefore not showing correctly. At the right size it shows fine after scaling. Thank you again for your work on ffmpeg+rockchip 👍
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: starred/ffmpeg-rockchip#16
No description provided.