hbiyik / FFmpeg

PLEASE USE https://github.com/nyanmisaka/ffmpeg-rockchip REPO INSTEAD.
https://github.com/nyanmisaka/ffmpeg-rockchip
Other
89 stars 7 forks source link

ffmpeg transcode hang up #42

Closed ywangwxd closed 9 months ago

ywangwxd commented 9 months ago

I followed the instructions to compile ffmpeg with rockchip libarary. But when tried transcode a video such as

sudo ffmpeg -i 428cut.mp4 -c:v h264 out.mp4

the process is hanging up, I did not see any cpu loading for this process. It seems to wait for a key input, but when I press any key, it did not have any reaction, enven for q.

what is the problem?

ffmpeg version e243e8d001 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 10 (Debian 10.2.1-6) configuration: --enable-rkmpp --enable-version3 --enable-libdrm --logfile=log libavutil 58. 2.100 / 58. 2.100 libavcodec 60. 3.100 / 60. 3.100 libavformat 60. 3.100 / 60. 3.100 libavdevice 60. 1.100 / 60. 1.100 libavfilter 9. 3.100 / 9. 3.100 libswscale 7. 1.100 / 7. 1.100 libswresample 4. 10.100 / 4. 10.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x5562f15330] st: 0 edit list: 1 Missing key frame while searching for timestamp: 0 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '428cut.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf59.16.100 Duration: 00:01:20.00, start: 0.000000, bitrate: 575 kb/s Stream #0:00x1: Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, 573 kb/s, 25.03 fps, 25 tbr, 90k tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] File 'out.mp4' already exists. Overwrite? [y/N] y [h264_rkmpp_decoder @ 0x5562f1a720] Picture format is nv12. Stream mapping: Stream #0:0 -> #0:0 (h264 (h264_rkmpp_decoder) -> h264 (h264_rkmpp_encoder)) Press [q] to stop, [?] for help

great9 commented 9 months ago

do you get any errors in kernel log when this happens? dmesg output pls.

ywangwxd commented 9 months ago

Yes, I can see error in dmesg output. The follows are output by dmesg -Hk '' [Dec22 13:24] CFG80211-ERROR) wl_run_escan : [ +0.000009] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:25] hym8563_rtc_set_time ---ison [ +0.001946] hym8563_rtc_alarm_irq_enable enabled=0---ison [Dec22 13:26] CFG80211-ERROR) wl_run_escan : [ +0.000004] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:28] CFG80211-ERROR) wl_run_escan : [ +0.000009] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:30] CFG80211-ERROR) wl_run_escan : [ +0.000004] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:32] CFG80211-ERROR) wl_run_escan : [ +0.000009] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:34] CFG80211-ERROR) wl_run_escan : [ +0.000008] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:36] CFG80211-ERROR) wl_run_escan : [ +0.000010] LEGACY_SCAN sync ID: 4660, bssidx: 0 [ +12.944051] hym8563_rtc_set_time ---ison [ +0.002051] hym8563_rtc_alarm_irq_enable enabled=0---ison [Dec22 13:38] CFG80211-ERROR) wl_run_escan : [ +0.000009] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:40] CFG80211-ERROR) wl_run_escan : [ +0.000009] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:42] CFG80211-ERROR) wl_run_escan : [ +0.000009] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:44] CFG80211-ERROR) wl_run_escan : [ +0.000009] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:46] CFG80211-ERROR) wl_run_escan : [ +0.000008] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:47] hym8563_rtc_set_time ---ison [ +0.001695] hym8563_rtc_alarm_irq_enable enabled=0---ison [Dec22 13:48] CFG80211-ERROR) wl_run_escan : [ +0.000009] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:50] CFG80211-ERROR) wl_run_escan : [ +0.000009] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:52] CFG80211-ERROR) wl_run_escan : [ +0.000009] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:54] CFG80211-ERROR) wl_run_escan : [ +0.000004] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:56] CFG80211-ERROR) wl_run_escan : [ +0.000008] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:58] CFG80211-ERROR) wl_run_escan : [ +0.000004] LEGACY_SCAN sync ID: 4660, bssidx: 0 [Dec22 13:59] hym8563_rtc_set_time ---ison [ +0.001793] hym8563_rtc_alarm_irq_enable enabled=0---ison ''

great9 commented 9 months ago

these errors are irrelevant as they are related to wifi, not ffmpeg or rk3588 VPU

great9 commented 9 months ago

try running it with strace and see where it stops / locks up

ywangwxd commented 9 months ago

After I changed the input from mp4 file to a h264 raw stream file, I could decode it into images, transcoded it into another h264 or h265. I checked the resulted images from h264 decoding, seems all right.

But I got another problem. I could not decode the resulted H265 file into images. The transcoding process showed success. But the decoding into images showed errors:


nput #0, hevc, from 'out.h265':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: hevc (Main), yuv420p(tv), 640x480, 25 fps, 25 tbr, 1200k tbn
mpp[590897]: mpp_info: mpp version: ed377c99 author: Herman Chen   2023-12-14 fix[hal_enc]: Add encoder internal buffer sync
[hevc_rkmpp_decoder @ 0x5580611460] Picture format is nv12.
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (hevc_rkmpp_decoder) -> png (native))
Press [q] to stop, [?] for help
mpp[590897]: H265D_PARSER: PPS id out of range: 0
mpp[590897]: H265D_PARSER: hls_slice_header error ret = -1004
mpp[590897]: H265D_PARSER: Error parsing NAL unit #0,error ret = 0xd.
mpp[590897]: H265D_PARSER: current stream is no right skip it (nil)
mpp[590897]: H265D_PARSER: PPS id out of range: 0
mpp[590897]: H265D_PARSER: hls_slice_header error ret = -1004
mpp[590897]: H265D_PARSER: Error parsing NAL unit #0,error ret = 0xd.
mpp[590897]: H265D_PARSER: current stream is no right skip it (nil)
mpp[590897]: H265D_PARSER: PPS id out of range: 0
mpp[590897]: H265D_PARSER: hls_slice_header error ret = -1004
mpp[590897]: H265D_PARSER: Error parsing NAL unit #0,error ret = 0xd.
mpp[590897]: H265D_PARSER: current stream is no right skip it (nil)
mpp[590897]: H265D_PARSER: PPS id out of range: 0
mpp[590897]: H265D_PARSER: hls_slice_header error ret = -1004
mpp[590897]: H265D_PARSER: Error parsing NAL unit #0,error ret = 0xd.
mpp[590897]: H265D_PARSER: current stream is no right skip it (nil)
mpp[590897]: H265D_PARSER: PPS id out of range: 0
mpp[590897]: H265D_PARSER: hls_slice_header error ret = -1004
mpp[590897]: H265D_PARSER: Error parsing NAL unit #0,error ret = 0xd.
mpp[590897]: H265D_PARSER: current stream is no right skip it (nil)

By the way, what I should do if I want to transcode a mp4 file?

ywangwxd commented 9 months ago

If I decode another h265 file downloaded from web, it seems ok. So the problem seems to be the transcoding.

ywangwxd commented 9 months ago

After I changed to input a h264 file or a rtsp video stream, transcoding is working.