我正在尝试将 RTP 流(opus、vp8)转换为 HLS(aac、libx264),但失败了。我可以轻松地将流保存为 WebM,但无法将其保存为 HLS,唯一明显的错误是cur_dts is invalid
。但它可以转换为 WebM 这一事实可能意味着一定有一种方法可以将其转换为 HLS。
似乎与视频的时间戳不正常有关。但没有任何标志genpts
igndts
或discardcorrupt
帮助我。我也试过了-use_wallclock_as_timestamps 1
ffmpeg
-loglevel debug
-protocol_whitelist pipe,udp,rtp
-f sdp
-fflags genpts,
-analyzeduration 10000000,
-probesize 10000000',
-i pipe:0
-y -c:v libx264 -crf 25
-vprofile baseline
-r 24 -g 24
-c:a aac
-hls_list_size 1
-hls_time 2
-hls_playlist_type event
-hls_flags independent_segments
-sc_threshold 0
-preset veryfast
b3a7f37f-972e-4784-8bf7-eaaad258d3c8.m3u8
输出:
Stderr output: [libx264 @ 0x6d01540] frame= 124 QP=16.26 NAL=2 Slice:P Poc:8 I:6 P:12 SKIP:3582 size=75 bytes
0|app | Stderr output: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
0|app | Stderr output: Last message repeated 1 times
0|app | Stderr output: [libx264 @ 0x6d01540] frame= 125 QP=13.45 NAL=2 Slice:P Poc:10 I:8 P:6 SKIP:3586 size=55 bytes
0|app | Stderr output: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
0|app | Stderr output: Last message repeated 3 times
0|app | Stderr output: *** dropping frame 140 from stream 0 at ts 138
0|app | Stderr output: [libx264 @ 0x6d01540] frame= 126 QP=15.22 NAL=2 Slice:P Poc:12 I:7 P:6 SKIP:3587 size=59 bytes
0|app | Stderr output: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
0|app | Stderr output: Last message repeated 1 times
0|app | Stderr output: [libx264 @ 0x6d01540] frame= 127 QP=14.70 NAL=2 Slice:P Poc:14 I:8 P:7 SKIP:3585 size=65 bytes
0|app | Stderr output: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
0|app | Stderr output: Last message repeated 1 times
0|app | Stderr output: [libx264 @ 0x6d01540] frame= 128 QP=15.12 NAL=2 Slice:P Poc:16 I:4 P:9 SKIP:3587 size=61 bytes
0|app | Stderr output: Too many packets buffered for output stream 0:0.
0|app | Stderr output: [libx264 @ 0x6d01540] frame I:6 Avg QP:10.60 size: 3053
0|app | Stderr output: [libx264 @ 0x6d01540] frame P:123 Avg QP:15.13 size: 88
0|app | Stderr output: [libx264 @ 0x6d01540] mb I I16..4: 100.0% 0.0% 0.0%
0|app | Stderr output: [libx264 @ 0x6d01540] mb P I16..4: 0.2% 0.0% 0.0% P16..4: 0.4% 0.0% 0.0% 0.0% 0.0% skip:99.4%
0|app | Stderr output: [libx264 @ 0x6d01540] coded y,uvDC,uvAC intra: 0.2% 3.0% 0.0% inter: 0.0% 0.4% 0.0%
0|app | Stderr output: [libx264 @ 0x6d01540] i16 v,h,dc,p: 98% 0% 2% 0%
0|app | Stderr output: [libx264 @ 0x6d01540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 0% 0% 100% 0% 0% 0% 0% 0% 0%
0|app | Stderr output: [libx264 @ 0x6d01540] i8c dc,h,v,p: 98% 1% 1% 0%
0|app | Stderr output: [libx264 @ 0x6d01540] kb/s:43.38
0|app | Stderr output: [AVIOContext @ 0x6c58ac0] Statistics: 210 bytes read, 0 seeks
0|app | Stderr output: Conversion failed!
我也尝试了 -use_wallclock_as_timestamps 1 并且输出变为这样:
[hls @ 0x7021680] Delay between the first packet and last packet in the muxing queue is 10029056 > 10000000: forcing output
0|app | Stderr output: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
0|app | Stderr output: [hls @ 0x7021680] Delay between the first packet and last packet in the muxing queue is 10026800 > 10000000: forcing output
0|app | Stderr output: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
0|app | Stderr output: [hls @ 0x7021680] Delay between the first packet and last packet in the muxing queue is 10027288 > 10000000: forcing output
0|app | Stderr output: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
0|app | Stderr output: [hls @ 0x7021680] Delay between the first packet and last packet in the muxing queue is 10033722 > 10000000: forcing output
0|app | Stderr output: [hls @ 0x7021680] Delay between the first packet and last packet in the muxing queue is 10005822 > 10000000: forcing output
0|app | Stderr output: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
0|app | Stderr output: Last message repeated 1 times