ffmpeg -f段在30分钟后失败

时间:2018-03-07 00:07:59

标签: ffmpeg

当我使用下面的命令将从命名管道接收的视频流转换为HLS格式的.ts文件时,

sudo ffmpeg -i named_pipe.mkv \
-c:v libx264 -r 10 -g 30 -map 0  \
-qmin 18 -qmax 30 \
-f segment -segment_format mpegts -segment_time 3 \
-segment_list list.m3u8 \
-segment_list_type hls\
-segment_list_size 20 -strftime 1 \
%Y-%m-%d_%Hh%Mm%Ss.ts

大约30分钟后,速度会逐渐下降。 这是在它停止工作之前的日志。

*** dropping frame 2461 from stream 0 at ts -11787
[h264 @ 0x5639c4f49440] nal_unit_type: 1, nal_ref_idc: 1
*** dropping frame 2461 from stream 0 at ts -11787
[h264 @ 0x5639c4fde520] nal_unit_type: 1, nal_ref_idc: 1
*** dropping frame 2461 from stream 0 at ts -11787
[h264 @ 0x5639c4ffa4a0] nal_unit_type: 1, nal_ref_idc: 1
*** dropping frame 2461 from stream 0 at ts -11786
[h264 @ 0x5639c5016420] nal_unit_type: 1, nal_ref_idc: 1
*** dropping frame 2461 from stream 0 at ts -11786
[h264 @ 0x5639c50323a0] nal_unit_type: 1, nal_ref_idc: 1
*** dropping frame 2461 from stream 0 at ts -11786
[h264 @ 0x5639c504e320] nal_unit_type: 1, nal_ref_idc: 1
*** dropping frame 2461 from stream 0 at ts -11785
[h264 @ 0x5639c4c46e20] nal_unit_type: 1, nal_ref_idc: 1
*** dropping frame 2461 from stream 0 at ts -11785
*** dropping frame 2461 from stream 0 at ts -11785
*** dropping frame 2461 from stream 0 at ts -11784
*** dropping frame 2461 from stream 0 at ts -11784
*** dropping frame 2461 from stream 0 at ts -11784
*** dropping frame 2461 from stream 0 at ts -11783
*** dropping frame 2461 from stream 0 at ts -11783
*** dropping frame 2461 from stream 0 at ts -11783
*** dropping frame 2461 from stream 0 at ts -11782
*** dropping frame 2461 from stream 0 at ts -11782
*** dropping frame 2461 from stream 0 at ts -11782
*** dropping frame 2461 from stream 0 at ts -11781
*** dropping frame 2461 from stream 0 at ts -11781
*** dropping frame 2461 from stream 0 at ts -11781
*** dropping frame 2461 from stream 0 at ts -11780
*** dropping frame 2461 from stream 0 at ts -11780
[out_0_0 @ 0x5639c4b58b40] EOF on sink link out_0_0:default.
*** dropping frame 2461 from stream 0 at ts -11780
No more output streams to write to, finishing.
[segment @ 0x5639c4b4ab20] stream:0 start_pts_time:243 pts:22131000 pts_time:245.9 dts:22131000 dts_time:245.9 -> pts:22131000 pts_time:245.9 dts:22131000 dts_time:245.9
[segment @ 0x5639c4b4ab20] Opening '/var/www/html/hls/list.m3u8.tmp' for writing
[file @ 0x5639c6510be0] Setting default whitelist 'file,crypto'
[segment @ 0x5639c4b4ab20] EXT-X-MEDIA-SEQUENCE:62
[AVIOContext @ 0x5639c4f01f80] Statistics: 0 seeks, 1 writeouts
[segment @ 0x5639c4b4ab20] segment:'/var/www/html/hls/2018-03-06_15h59m25s.ts' count:81 ended
[AVIOContext @ 0x5639c4d1cca0] Statistics: 0 seeks, 1 writeouts
[segment @ 0x5639c4b4ab20] Opening '/var/www/html/hls/2018-03-06_16h18m11s.ts' for writing
[file @ 0x5639c4b8da80] Setting default whitelist 'file,crypto'

1 个答案:

答案 0 :(得分:0)

您可以使用-re确保输出和命名管道输入的运行速度相同。如果您的输出速度快于输入速率-re将使过程保持相同的速度而不会停止。

sudo ffmpeg -re -i named_pipe.mkv \
-c:v libx264 -r 10 -g 30 -map 0  \
-qmin 18 -qmax 30 \
-f segment -segment_format mpegts -segment_time 3 \
-segment_list list.m3u8 \
-segment_list_type hls\
-segment_list_size 20 -strftime 1 \
%Y-%m-%d_%Hh%Mm%Ss.ts