ffmpeg - 如何使用 ffmpeg 确定传入 RTMP 流的分辨率?

标签 ffmpeg rtmp transcoding

我正在使用 ffmpeg 将 RTMP 从我自己的 RTMP 服务器转码为 HLS 就绪的 H.264。目前,我正在执行以下形式的命令

ffmpeg -i rtmp://<ip>:<port> <options for 480p> <options for 720p30> <options for 720p60> <options for 1080p>

这导致我尝试将较低的分辨率转码为较高的分辨率。

我使用的 RTMP 服务器是 nginx with RTMP module

有没有一种方法可以确定源分辨率,以便我只转码为小于源分辨率的分辨率?

最佳答案

感谢@szatmary 的评论,我找到了以下解决方案:

我可以使用命令行工具 ffprobe 来获取有关流的信息。 Here is the documentation

它说 here

If a url is specified in input, ffprobe will try to open and probe the url content. If the url cannot be opened or recognized as a multimedia file, a positive exit code is returned.



ffprobe 可以配置为使用不同的写入器和写入选项,以便它可以以多种格式返回结果。

关于ffmpeg - 如何使用 ffmpeg 确定传入 RTMP 流的分辨率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55121629/

相关文章:

FFmpeg - 捕获 rtsp 流并将其重新流式传输到另一个 rtsp 服务器

c - Rtmp 流通过 gstreamer-1.0 appsrc 到 rtmpsink

java - 转码只有在客户端超时后才完成?

c++ - 在 Visual Studio C++ 中调用 ffmpeg.exe

Ffmpeg 在 channel 更改时对 HDHomerun Prime 进行转码时挂起

ffmpeg - 如何使用 execv 执行 ffmpeg 摄取 rtmp 流

ios - 如何在 ffmpeg 中使用 librtmp?

video - 这个GPU视频转码项目可行吗?

ffmpeg - 如果 HTTP Live Stream 从开头开始,视频流播放过快

FFMPEG实时流捕获: Any option to find stream is down?