FFMPEG 停止转换

FFMPEG 停止转换

我使用的是 Ubuntu 12.04 LTS,它运行的是 Wowza Media Server,因此我使用 FFmpeg 作为直播的转码器,并在我的网站上使用 JWplayer。但是 ffmpeg 总是停止转换,我不得不一次又一次地输入命令。因此,命令如下:

nohup ffmpeg -i rtsp://log:pass@<cameraip>:554/live1.sdp -ar 44100 -ab 128k -f flv -b 5000k -s 480x270 -y rtmp://<serverip>:1935/live/camera.stream &

这就是我得到的

ffmpeg version 0.8.10-4:0.8.10-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Feb  6 2014 20:56:59 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[rtsp @ 0x25317a0] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 150.00 (150/1) -> 1000.00 (1000/1)
Input #0, rtsp, from 'rtsp://log:pass@<cameraip>:554/live1.sdp':
  Metadata:
    title           : RTSP/RTP stream 1 from DCS-2132L
    comment         : live1.sdp with v2.0
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: h264 (High), yuvj420p, 640x360 [PAR 1:1 DAR 16:9], 75 fps, 1k tbr, 90k tbn, 150 tbc
    Stream #0.1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s
Incompatible pixel format 'yuvj420p' for codec 'mpeg4', auto-selecting format 'yuv420p'
[buffer @ 0x2539f80] w:640 h:360 pixfmt:yuvj420p
[scale @ 0x253a940] w:640 h:360 fmt:yuvj420p -> w:480 h:270 fmt:yuv420p flags:0x4
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
[ac3 @ 0x2531120] channel_layout not specified
[ac3 @ 0x2531120] No channel layout specified. The encoder will guess the layout, but it might be incorrect.
[ac3 @ 0x2531120] invalid bit rate
Output #0, avi, to 'rtmp://<serverip>:1935/live/camera.stream':
    Stream #0.0: Video: mpeg4, yuv420p, 480x270 [PAR 1:1 DAR 16:9], q=2-31, 1024 kb/s, 90k tbn, 1k tbc
    Stream #0.1: Audio: ac3, 22050 Hz, mono, flt, 1024 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height

答案1

您的转换尝试使用ac3编码器进行音频转换,但在设置比特率时失败。我非常确定 AC3 音频不是您想要的流媒体视频,您也可以使用H.264编码器类似libx264而不是普通的MPEG-4 第二部分视频 (mpeg-4)。

使用 H.264 视频,您甚至不需要 ~5 MBit/s 比特率 — 您可以使用更低的比特率实现相同的视觉质量。根据输入,您可以尝试 ~2 MBit/s 甚至更低。480×270 的分辨率相当低,我猜即使是 500 kBit/s 看起来也还可以接受。

此外,你正在使用一个过时且有缺陷的程序,名为ffmpeg 这不是来自 FFmpeg而是该项目的一个分支。请下载最近的静态构建继续开发。您也可以自己编译;这并不需要那么长时间。

此外,-y是一个全局选项,需要位于输入选项之前。

您的命令可能如下所示:

ffmpeg -y -i <input> \
-f flv \
-c:v libx264 -b:v 2000k \
-c:a aac -strict experimental -b:a 128k -ar 44100 \
-s 480x270 rtmp://<serverip>:1935/live/camera.stream

相关内容