【问题标题】:ffmpeg streamaudio video webcam raspberry piffmpeg 流音频视频网络摄像头树莓派
【发布时间】:2015-11-03 14:17:23
【问题描述】:

我在我的 Rpi 上使用网络摄像头来录制音频视频。我正在使用 ffmpeg 这是我的命令:

ffmpeg -y -ac 1 -f alsa -i hw:1,0 -i /dev/video1 -r 10 -s 120*120 -async 1 -strict -2 -c:a aac -pix_fmt yuv420p -threads 0 -ar 44100 -f mpegts out.avi

这会生成一个带有视频和音频的.avi 文件,但是当我尝试使用 ffserver 流式传输时:

ffmpeg -y -ac 1 -f alsa -i hw:1,0 -i /dev/video1 -r 10 -s 120*120 -async 1 -strict -2 -c:a aac -pix_fmt yuv420p -threads 0 -ar 44100 -f mpegts http\\some_ip:someport\webcam.ffm

我收到av_interleaved_write_frame(): Broken pip

我该如何解决这个问题?任何其他流式传输音频视频的建议(请不要使用 Motion)。

更新

这是我的 ffserver 配置文件

    Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
#NoDaemon

<Feed feed1.ffm>
    File /tmp/feed1.ffm
    FileMaxSize 200K
    ACL allow 127.0.0.1
</Feed>

# if you want to use mpegts format instead of flv
# then change "live.flv" to "live.ts"
# and also change "Format flv" to "Format mpegts"
<Stream live.avi>
    Format mpegts
    Feed feed1.ffm

    VideoCodec mjpeg
    VideoFrameRate 30
    VideoBitRate 512
    VideoSize 320x240
    AVOptionVideo crf 23
    AVOptionVideo preset medium
    # for more info on crf/preset options, type: x264 --help
    AVOptionVideo flags +global_header

    AudioCodec aac
    Strict -2
    AudioBitRate 128
    AudioChannels 2
    AudioSampleRate 44100
    AVOptionAudio flags +global_header
</Stream>

当我将流保存到本地文件 out.avi 时,我可以看到视频和音频,但是当我在 Windows 机器上使用 ffserver vlc 时甚至无法显示视频(不时出现一些声音故障的黑屏) 谢谢。

【问题讨论】:

    标签: video ffmpeg raspberry-pi broken-pipe


    【解决方案1】:

    将源推送到ffserver 时,您必须使用ffm 格式。删除 -f mpegts 并确保 URL 以 .ffm 结尾或替换为 -f ffm

    FFserver Wiki

    【讨论】:

    • 我试过了,但流没有音频流只有视频
    • @user3291059 在这种情况下,您应该发布命令的完整控制台输出和ffserver 配置
    • 请看一下我的配置文件
    猜你喜欢
    • 1970-01-01
    • 2021-08-11
    • 1970-01-01
    • 2018-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多