【问题标题】:mapping 3 or more outputs on ffmpeg command在 ffmpeg 命令上映射 3 个或更多输出
【发布时间】:2022-01-10 14:41:33
【问题描述】:

我正在使用以下命令在多个输出上进行流式传输,直到 2 个输出都可以正常工作,但是当我添加第三个输出时,它给出了错误-

2 个输出的命令-

ffmpeg_stream = 'ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -s 1920x1080  -i :122 -f alsa -i pulse -ac 2 -c:a aac -b:a 64k -threads 0 -flags +global_header -c:v libx264 -pix_fmt yuv420p -s 1920x1080 -threads 0 -f tee -map 0:0 -map 1:0 "[f=flv]rtmps://live-api-s.facebook.com:443/rtmp/stream_key|[f=flv]rtmp://a.rtmp.youtube.com/live2/stream_key"'

3 个输出的命令-

ffmpeg_stream = 'ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -s 1920x1080  -i :122 -f alsa -i pulse -ac 2 -c:a aac -b:a 64k -threads 0 -flags +global_header -c:v libx264 -pix_fmt yuv420p -s 1920x1080 -threads 0 -f tee -map 0:0 -map 1:0 -map 2:0 "[f=flv]rtmps://live-api-s.facebook.com:443/rtmp/stream_key|[f=flv]rtmp://a.rtmp.youtube.com/live2/stream_key|[f=flv]rtmp://play.stream.some_domain/stream/i48b-rdq0-jwme-2yj0"'

错误-

liveStreaming   | Invalid input file index: 2.

仅自定义 rtmp url 出错-

liveStreaming   | [rtmp @ 0x55af7e7f8280] Server error: Already 

publishing
liveStreaming   | [tee @ 0x55af7e12f540] Slave '[f=flv]rtmp://stream.domain/stream/i48b-rdq0-jwme-2yj0': error opening: Operation not permitted
liveStreaming   | [tee @ 0x55af7e12f540] Slave muxer #1 failed, aborting.
liveStreaming   | [flv @ 0x55af7e4d1880] Failed to update header with correct duration.
liveStreaming   | [flv @ 0x55af7e4d1880] Failed to update header with correct filesize.
liveStreaming   | Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
liveStreaming   | Error initializing output stream 0:1 -- 
liveStreaming   | [aac @ 0x55af7e1346c0] Qavg: -nan
liveStreaming   | [alsa @ 0x55af7e111dc0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
liveStreaming   | Conversion failed!

谢谢

【问题讨论】:

    标签: python-3.x ffmpeg


    【解决方案1】:

    -map 用于添加输入流进行输出。您只有 2 个输入。对于使用tee 的第三个输出,您只需像之前那样将其添加到输出 URL 中。删除-map 2:0

    ffmpeg_stream = 'ffmpeg -thread_queue_size 1024 -f x11grab -draw_mouse 0 -s 1920x1080 -i :122 -f alsa -i pulse -ac 2 -c:a aac -b:a 64k -threads 0 -flags +global_header -c:v libx264 -pix_fmt yuv420p -s 1920x1080 -threads 0 -f tee -map 0:0 -map 1:0 "[f=flv]rtmps://live-api-s.facebook.com:443/rtmp/stream_key|[f=flv]rtmp://a.rtmp.youtube.com/live2/stream_key|[f=flv]rtmp://play.stream.some_domain/stream/i48b-rdq0-jwme-2yj0"'

    【讨论】:

    • 嘿,感谢您的帮助。它适用于除自定义 rtmp url 之外的所有 rtmp url。我想我需要添加 -flvflags no_duration_filesize 但我无法使用 tee 命令使其工作。
    • 您必须将其添加到该输出的选项中:[f=flv:flvflags=no_duration_filesize]
    猜你喜欢
    • 2021-12-15
    • 1970-01-01
    • 2018-08-31
    • 2013-12-28
    • 1970-01-01
    • 2017-05-12
    • 1970-01-01
    • 1970-01-01
    • 2020-08-04
    相关资源
    最近更新 更多