每个人
我使用罗技 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
这条消息告诉我什么?
有什么需要改进的吗?
谢谢
最佳答案
您可以修复 DTS
添加 -use_wallclock_as_timestamps 1
导致的错误在您的相机输入之前,thread_queue_size
也是如此错误,添加-thread_queue_size 512
之前 -i
.
例如
ffmpeg -use_wallclock_as_timestamps 1 -thread_queue_size 512 -i /dev/video0 -c copy test.mp4
来自Jann的简要说明
This forces FFMPEG (a hack really) to use the recording SYSTEM's timestamp instead of trying to compute the time of the movie depending on the number of fps it detects. FPS detection is notoriously inaccurate, for instance.
As FFMPEG freely admits when it gives this error:
Estimating duration from bitrate, this may be inaccurate
.This also enables the
-t
flag (duration) to be real-time as well, instead of also being dependent on the fps calculation.
关于ffmpeg - 优酷直播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49631460/