Youtube直播

时间:2018-04-03 13:32:58

标签: ffmpeg

大家 我使用Logitech C920R将实况发布到Youtube。

命令如下。

#! / bin / sh
YOUTUBE_URL = "rtmp: //a.rtmp.youtube.com/live2"
KEY = "xxxx-yyyy-zzzz"
v4l2 - ctl --device = / dev / video0 - set - fmt - video = width = 1280, height = 720
ffmpeg - ar 44100 - ac 2 - f alsa - i hw: 1,0 - f v 4 l 2 - codec: v h 264 - framerate 30 - video-- size 1280 x 720 --itsoffset 0.5 \
-i / dev / video0 - copyyinkf - codec: v copy - codec: a aac - ab 128 k - g 10 - strict experimental \
-f flv $ YOUTUBE_URL / $ KEY
1> / dev / null 2> / dev / null &

当我运行此命令时,我收到以下消息。

[alsa @ 0xbbe770] ALSA buffer xrun.
[video4linux2,v4l2 @ 0xbc92d0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[alsa @ 0xbbe770] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[flv @ 0xc3d940] Non-monotonous DTS in output stream 0:0; previous: 500, current: 329; changing to 500. This may result in incorrect timestamps in the output file.
[flv @ 0xc3d940] Non-monotonous DTS in output stream 0:0; previous: 500, current: 361; changing to 500. This may result in incorrect timestamps in the output file.
[flv @ 0xc3d940] Non-monotonous DTS in output stream 0:0; previous: 500, current: 393; changing to 500. This may result in incorrect timestamps in the output file.
[flv @ 0xc3d940] Non-monotonous DTS in output stream 0:0; previous: 500, current: 429; changing to 500. This may result in incorrect timestamps in the output file.
[flv @ 0xc3d940] Non-monotonous DTS in output stream 0:0; previous: 500, current: 461; changing to 500. This may result in incorrect timestamps in the output file.
[flv @ 0xc3d940] Non-monotonous DTS in output stream 0:0; previous: 500, current: 497; changing to 500. This may result in incorrect timestamps in the output file.
frame= 1112 fps= 31 q=-1.0 size=   14271kB time=00:00:42.16 bitrate=2772.7kbits/s speed=1.18x

这条消息告诉我什么?

有什么需要改进吗?

谢谢

1 个答案:

答案 0 :(得分:0)

您可以通过在相机输入之前添加DTS来解决-use_wallclock_as_timestamps 1错误,对于thread_queue_size错误也应如此,在-thread_queue_size 512之前添加-i。 / p>

例如

ffmpeg -use_wallclock_as_timestamps 1 -thread_queue_size 512 -i /dev/video0 -c copy test.mp4

Jann的简要说明

  

这迫使FFMPEG(确实是黑客)使用录音系统的   时间戳,而不是尝试根据   检测到的fps数。 FPS检测众所周知   例如,不准确。

     

当FFMPEG对此进行免费承认时,   错误:Estimating duration from bitrate, this may be inaccurate

     

这也使-t标志(持续时间)也可以是实时的,而不是   也取决于fps的计算。