Do i need special flags for ffmpeg to capture interlaced video from CSI via tc358743 ( hdmi to csi converter ) #176

Closed
opened 2025-12-23 10:35:11 +01:00 by backuprepo · 1 comment
Owner

Originally created by @YumingChang02 on GitHub (May 9, 2025).

I am trying to use CSI interface for 1080p 60fps capturing ( and streaming ) from HDMI ( i tried ms2130 on USB3 but rk3566 seems too slow )
while capturing with 1080p60 everything seems to work with

ffmpeg -loglevel warning -stats -f v4l2 -framerate 60 -thread_queue_size 128 -video_size 1920x1080 -i /dev/video1 -vf "fps=60" -c:v h264_rkmpp -rc_mode AVBR -b:v 6M -minrate 3M -maxrate 8M -profile:v main -level 5.1 -g 120 -f hls -hls_time 2 -hls_list_size 5 -hls_flags delete_segments '/home/markchang/new/static/hls/playlist.m3u8'

when i try on 1080i, this is where problems happen
i have to use video1 since interlaced required selfpath

this is the input message from tc35874 CSI to HDMI module

markchang@radxa-zero3:~$ sudo dmesg | grep tc35874
[   12.301333] platform csi2-dphy0: Fixed dependency cycle(s) with /i2c@fe5b0000/tc358743@f
[   14.126177] tc35874x 2-000f: driver version: 00.01.01
[   14.128743] tc35874x 2-000f: Consider updating driver tc35874x to match on endpoints
[   14.128784] rockchip-csi2-dphy csi2-dphy0: dphy0 matches m00_b_tc35874x 2-000f:bus type 5
[   14.238649] m00_b_tc35874x 2-000f: tc358743 found @ 0x1e (rk3x-i2c)
[   14.354843]   #0: tc358743-hdmiin
[   15.285661] m00_b_tc35874x 2-000f: tc35874x_format_change: New format: 1920x1080i30.00 (2200x562)
[   16.276663] m00_b_tc35874x 2-000f: tc35874x_format_change: New format: 1920x1080i30.00 (2200x562)
[   16.292438] m00_b_tc35874x 2-000f: tc35874x_format_change: New format: 1920x1080i30.00 (2200x562)

when i run ffmpeg from above, it only hangs with ( the following info is when ffmpeg loglevel is set to verbose )

[video4linux2,v4l2 @ 0xaaab0fe1a600] fd:3 capabilities:84201000
[video4linux2,v4l2 @ 0xaaab0fe1a600] ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device
[video4linux2,v4l2 @ 0xaaab0fe1a600] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device, using framerate 60/1
Input #0, video4linux2,v4l2, from '/dev/video1':
  Duration: N/A, bitrate: 414 kb/s
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1920x1080 (0x0), 414 kb/s, 0.02 fps, 0.02 tbr, 1000k tbn
[out#0/hls @ 0xaaab0fe1c8e0] No explicit maps, mapping streams automatically...
[vost#0:0/h264_rkmpp @ 0xaaab0fe1f450] Created video stream from input stream 0:0
[Parsed_fps_0 @ 0xaaab0fe20710] 0 frames in, 0 frames out; 0 frames dropped, 0 frames duplicated.
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_rkmpp))
Press [q] to stop, [?] for help
[vist#0:0/rawvideo @ 0xaaab0fe1bec0] Decoder thread received EOF packet
[vist#0:0/rawvideo @ 0xaaab0fe1bec0] Decoder returned EOF, finishing
[vist#0:0/rawvideo @ 0xaaab0fe1bec0] Terminating decoder thread
[graph 0 input from stream 0:0 @ 0xaaab0fe226a0] w:1920 h:1080 pixfmt:yuv420p tb:1/1000000 fr:1/60 sar:0/1
[Parsed_fps_0 @ 0xaaab0fe22530] fps=60/1
[out#0/hls @ 0xaaab0fe1c8e0] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=N/A bitrate=N/A speed=N/A
[Parsed_fps_0 @ 0xaaab0fe22530] 0 frames in, 0 frames out; 0 frames dropped, 0 frames duplicated.
Exiting normally, received signal 2.

this is the corresponding kernel message when the ffmpeg hangs

[ 6690.987668] rkisp_hw fdff0000.rkisp: set isp clk = 396000000Hz
[ 6690.987807] rockchip-csi2-dphy0: dphy0, data_rate_mbps 620
[ 6690.987850] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:1, dphy0, ret 0
[ 6691.001047] rkisp-vir0: CIF_ISP_PIC_SIZE_ERROR (0x00000001)

this is the media-ctl topo

Media controller API version 6.1.99

Media device information
------------------------
driver          rkisp-vir0
model           rkisp0
serial
bus info        platform:rkisp-vir0
hw revision     0x0
driver version  6.1.99

Device topology
- entity 1: rkisp-isp-subdev (4 pads, 8 links, 0 routes)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [stream:0 fmt:UYVY8_2X8/1920x1080 field:none colorspace:smpte170m
                 crop.bounds:(0,0)/1920x1080
                 crop:(0,0)/1920x1080]
                <- "rkisp-csi-subdev":1 [ENABLED]
                <- "rkisp_rawrd0_m":0 []
                <- "rkisp_rawrd2_s":0 []
        pad1: Sink
                <- "rkisp-input-params":0 [ENABLED]
        pad2: Source
                [stream:0 fmt:YUYV8_2X8/1920x1080 field:none colorspace:smpte170m quantization:full-range
                 crop.bounds:(0,0)/1920x1080
                 crop:(0,0)/1920x1080]
                -> "rkisp_mainpath":0 [ENABLED]
                -> "rkisp_selfpath":0 [ENABLED]
                -> "rkisp_iqtool":0 [ENABLED]
        pad3: Source
                -> "rkisp-statistics":0 [ENABLED]

- entity 6: rkisp-csi-subdev (6 pads, 5 links, 0 routes)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Sink
                [stream:0 fmt:UYVY8_2X8/1920x1080 field:interlaced colorspace:smpte170m]
                <- "rockchip-csi2-dphy0":1 [ENABLED]
        pad1: Source
                [stream:0 fmt:UYVY8_2X8/1920x1080 field:interlaced colorspace:smpte170m]
                -> "rkisp-isp-subdev":0 [ENABLED]
        pad2: Source
                -> "rkisp_rawwr0":0 [ENABLED]
        pad3: Source
        pad4: Source
                -> "rkisp_rawwr2":0 [ENABLED]
        pad5: Source
                -> "rkisp_rawwr3":0 [ENABLED]

- entity 13: rkisp_mainpath (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video0
        pad0: Sink
                <- "rkisp-isp-subdev":2 [ENABLED]

- entity 19: rkisp_selfpath (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video1
        pad0: Sink
                <- "rkisp-isp-subdev":2 [ENABLED]

- entity 25: rkisp_rawwr0 (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video2
        pad0: Sink
                <- "rkisp-csi-subdev":2 [ENABLED]

- entity 31: rkisp_rawwr2 (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video3
        pad0: Sink
                <- "rkisp-csi-subdev":4 [ENABLED]

- entity 37: rkisp_rawwr3 (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video4
        pad0: Sink
                <- "rkisp-csi-subdev":5 [ENABLED]

- entity 43: rkisp_iqtool (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video5
        pad0: Sink
                <- "rkisp-isp-subdev":2 [ENABLED]

- entity 49: rkisp_rawrd0_m (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video6
        pad0: Source
                -> "rkisp-isp-subdev":0 []

- entity 55: rkisp_rawrd2_s (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video7
        pad0: Source
                -> "rkisp-isp-subdev":0 []

- entity 61: rkisp-statistics (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video8
        pad0: Sink
                <- "rkisp-isp-subdev":3 [ENABLED]

- entity 67: rkisp-input-params (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video9
        pad0: Source
                -> "rkisp-isp-subdev":1 [ENABLED]

- entity 73: rockchip-csi2-dphy0 (2 pads, 2 links, 0 routes)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev2
        pad0: Sink
                [stream:0 fmt:UYVY8_2X8/1920x1080@10000/600000 field:interlaced colorspace:smpte170m]
                <- "m00_b_tc35874x 2-000f":0 [ENABLED]
        pad1: Source
                -> "rkisp-csi-subdev":0 [ENABLED]

- entity 76: m00_b_tc35874x 2-000f (1 pad, 1 link, 0 routes)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev3
        pad0: Source
                [stream:0 fmt:UYVY8_2X8/1920x1080@10000/600000 field:interlaced colorspace:smpte170m]
                [dv.caps:BT.656/1120 min:1x1@0 max:10000x10000@310000000 stds:CEA-861,DMT,CVT,GTF caps:interlaced,progressive,reduced-blanking,custom]
                [dv.detect:BT.656/1120 1920x1080i14 (2200x1125) stds: flags:]
                [dv.current:BT.656/1120 1920x1080i14 (2200x1125) stds: flags:]
                -> "rockchip-csi2-dphy0":0 [ENABLED]
Originally created by @YumingChang02 on GitHub (May 9, 2025). I am trying to use CSI interface for 1080p 60fps capturing ( and streaming ) from HDMI ( i tried ms2130 on USB3 but rk3566 seems too slow ) while capturing with 1080p60 everything seems to work with ``` ffmpeg -loglevel warning -stats -f v4l2 -framerate 60 -thread_queue_size 128 -video_size 1920x1080 -i /dev/video1 -vf "fps=60" -c:v h264_rkmpp -rc_mode AVBR -b:v 6M -minrate 3M -maxrate 8M -profile:v main -level 5.1 -g 120 -f hls -hls_time 2 -hls_list_size 5 -hls_flags delete_segments '/home/markchang/new/static/hls/playlist.m3u8' ``` when i try on 1080i, this is where problems happen i have to use video1 since interlaced required selfpath this is the input message from tc35874 CSI to HDMI module ``` markchang@radxa-zero3:~$ sudo dmesg | grep tc35874 [ 12.301333] platform csi2-dphy0: Fixed dependency cycle(s) with /i2c@fe5b0000/tc358743@f [ 14.126177] tc35874x 2-000f: driver version: 00.01.01 [ 14.128743] tc35874x 2-000f: Consider updating driver tc35874x to match on endpoints [ 14.128784] rockchip-csi2-dphy csi2-dphy0: dphy0 matches m00_b_tc35874x 2-000f:bus type 5 [ 14.238649] m00_b_tc35874x 2-000f: tc358743 found @ 0x1e (rk3x-i2c) [ 14.354843] #0: tc358743-hdmiin [ 15.285661] m00_b_tc35874x 2-000f: tc35874x_format_change: New format: 1920x1080i30.00 (2200x562) [ 16.276663] m00_b_tc35874x 2-000f: tc35874x_format_change: New format: 1920x1080i30.00 (2200x562) [ 16.292438] m00_b_tc35874x 2-000f: tc35874x_format_change: New format: 1920x1080i30.00 (2200x562) ``` when i run ffmpeg from above, it only hangs with ( the following info is when ffmpeg loglevel is set to verbose ) ``` [video4linux2,v4l2 @ 0xaaab0fe1a600] fd:3 capabilities:84201000 [video4linux2,v4l2 @ 0xaaab0fe1a600] ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device [video4linux2,v4l2 @ 0xaaab0fe1a600] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device, using framerate 60/1 Input #0, video4linux2,v4l2, from '/dev/video1': Duration: N/A, bitrate: 414 kb/s Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1920x1080 (0x0), 414 kb/s, 0.02 fps, 0.02 tbr, 1000k tbn [out#0/hls @ 0xaaab0fe1c8e0] No explicit maps, mapping streams automatically... [vost#0:0/h264_rkmpp @ 0xaaab0fe1f450] Created video stream from input stream 0:0 [Parsed_fps_0 @ 0xaaab0fe20710] 0 frames in, 0 frames out; 0 frames dropped, 0 frames duplicated. Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_rkmpp)) Press [q] to stop, [?] for help [vist#0:0/rawvideo @ 0xaaab0fe1bec0] Decoder thread received EOF packet [vist#0:0/rawvideo @ 0xaaab0fe1bec0] Decoder returned EOF, finishing [vist#0:0/rawvideo @ 0xaaab0fe1bec0] Terminating decoder thread [graph 0 input from stream 0:0 @ 0xaaab0fe226a0] w:1920 h:1080 pixfmt:yuv420p tb:1/1000000 fr:1/60 sar:0/1 [Parsed_fps_0 @ 0xaaab0fe22530] fps=60/1 [out#0/hls @ 0xaaab0fe1c8e0] Nothing was written into output file, because at least one of its streams received no packets. frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=N/A bitrate=N/A speed=N/A [Parsed_fps_0 @ 0xaaab0fe22530] 0 frames in, 0 frames out; 0 frames dropped, 0 frames duplicated. Exiting normally, received signal 2. ``` this is the corresponding kernel message when the ffmpeg hangs ``` [ 6690.987668] rkisp_hw fdff0000.rkisp: set isp clk = 396000000Hz [ 6690.987807] rockchip-csi2-dphy0: dphy0, data_rate_mbps 620 [ 6690.987850] rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:1, dphy0, ret 0 [ 6691.001047] rkisp-vir0: CIF_ISP_PIC_SIZE_ERROR (0x00000001) ``` this is the media-ctl topo ``` Media controller API version 6.1.99 Media device information ------------------------ driver rkisp-vir0 model rkisp0 serial bus info platform:rkisp-vir0 hw revision 0x0 driver version 6.1.99 Device topology - entity 1: rkisp-isp-subdev (4 pads, 8 links, 0 routes) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0 pad0: Sink [stream:0 fmt:UYVY8_2X8/1920x1080 field:none colorspace:smpte170m crop.bounds:(0,0)/1920x1080 crop:(0,0)/1920x1080] <- "rkisp-csi-subdev":1 [ENABLED] <- "rkisp_rawrd0_m":0 [] <- "rkisp_rawrd2_s":0 [] pad1: Sink <- "rkisp-input-params":0 [ENABLED] pad2: Source [stream:0 fmt:YUYV8_2X8/1920x1080 field:none colorspace:smpte170m quantization:full-range crop.bounds:(0,0)/1920x1080 crop:(0,0)/1920x1080] -> "rkisp_mainpath":0 [ENABLED] -> "rkisp_selfpath":0 [ENABLED] -> "rkisp_iqtool":0 [ENABLED] pad3: Source -> "rkisp-statistics":0 [ENABLED] - entity 6: rkisp-csi-subdev (6 pads, 5 links, 0 routes) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1 pad0: Sink [stream:0 fmt:UYVY8_2X8/1920x1080 field:interlaced colorspace:smpte170m] <- "rockchip-csi2-dphy0":1 [ENABLED] pad1: Source [stream:0 fmt:UYVY8_2X8/1920x1080 field:interlaced colorspace:smpte170m] -> "rkisp-isp-subdev":0 [ENABLED] pad2: Source -> "rkisp_rawwr0":0 [ENABLED] pad3: Source pad4: Source -> "rkisp_rawwr2":0 [ENABLED] pad5: Source -> "rkisp_rawwr3":0 [ENABLED] - entity 13: rkisp_mainpath (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video0 pad0: Sink <- "rkisp-isp-subdev":2 [ENABLED] - entity 19: rkisp_selfpath (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video1 pad0: Sink <- "rkisp-isp-subdev":2 [ENABLED] - entity 25: rkisp_rawwr0 (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video2 pad0: Sink <- "rkisp-csi-subdev":2 [ENABLED] - entity 31: rkisp_rawwr2 (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video3 pad0: Sink <- "rkisp-csi-subdev":4 [ENABLED] - entity 37: rkisp_rawwr3 (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video4 pad0: Sink <- "rkisp-csi-subdev":5 [ENABLED] - entity 43: rkisp_iqtool (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video5 pad0: Sink <- "rkisp-isp-subdev":2 [ENABLED] - entity 49: rkisp_rawrd0_m (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video6 pad0: Source -> "rkisp-isp-subdev":0 [] - entity 55: rkisp_rawrd2_s (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video7 pad0: Source -> "rkisp-isp-subdev":0 [] - entity 61: rkisp-statistics (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video8 pad0: Sink <- "rkisp-isp-subdev":3 [ENABLED] - entity 67: rkisp-input-params (1 pad, 1 link) type Node subtype V4L flags 0 device node name /dev/video9 pad0: Source -> "rkisp-isp-subdev":1 [ENABLED] - entity 73: rockchip-csi2-dphy0 (2 pads, 2 links, 0 routes) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev2 pad0: Sink [stream:0 fmt:UYVY8_2X8/1920x1080@10000/600000 field:interlaced colorspace:smpte170m] <- "m00_b_tc35874x 2-000f":0 [ENABLED] pad1: Source -> "rkisp-csi-subdev":0 [ENABLED] - entity 76: m00_b_tc35874x 2-000f (1 pad, 1 link, 0 routes) type V4L2 subdev subtype Sensor flags 0 device node name /dev/v4l-subdev3 pad0: Source [stream:0 fmt:UYVY8_2X8/1920x1080@10000/600000 field:interlaced colorspace:smpte170m] [dv.caps:BT.656/1120 min:1x1@0 max:10000x10000@310000000 stds:CEA-861,DMT,CVT,GTF caps:interlaced,progressive,reduced-blanking,custom] [dv.detect:BT.656/1120 1920x1080i14 (2200x1125) stds: flags:] [dv.current:BT.656/1120 1920x1080i14 (2200x1125) stds: flags:] -> "rockchip-csi2-dphy0":0 [ENABLED] ```
backuprepo 2025-12-23 10:35:11 +01:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@nyanmisaka commented on GitHub (May 9, 2025):

I'm not sure if ffmpeg V4L2 supports interlaced input.

@nyanmisaka commented on GitHub (May 9, 2025): I'm not sure if ffmpeg V4L2 supports interlaced input.
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#176
No description provided.