如何在FFMPEG流中播放音频文件数据?

发布于 2025-02-06 13:10:11 字数 1048 浏览 3 评论 0原文

亲爱的FFMPEG实用程序的尊敬的专家!告诉我谁知道这一点: 我想通过循环视频和音轨在YouTube音乐上进行24/7流。 我这样做是这样的:

ffmpeg -loglevel info -stream_loop -1 -y -re \
    -i video.mp4 \
    -f concat -safe 0 -i playlist.txt \
    -c:v libx264 -preset veryfast -b:v 3000k -maxrate 3000k -bufsize 6000k \
    -framerate 25 -video_size 1280x720 -vf "format=yuv420p" -g 50 -shortest -strict experimental \
    -c:a aac -b:a 128k -ar 44100 \
    -f flv rtmp://localhost/live/my-stream

IE Video.mp4在循环中旋转,从playlist.txt文件中我播放mp3。 这样,一切都可以,一切都可以。但是我也想显示比赛曲目的标题。 例如,在一些YouTube收音机上:

封面非常完美!

有什么想法如何实施?

我知道可以通过绘制文字显示文本。您可以从文件中输出文本,您可以单独更新自己。但是如何获取当前播放文件的数据? FFMPEG不提供此类信息,仅提供流参数:fps,framerate ...还是可以得到它?

还是有更好,更轻松的方法?

事先感谢您的帮助!

Dears experts of the wonderful ffmpeg utility! Tell me please who knows this:
I want to make a 24/7 stream on YouTube of music from looped video and audio tracks.
I do it like this:

ffmpeg -loglevel info -stream_loop -1 -y -re \
    -i video.mp4 \
    -f concat -safe 0 -i playlist.txt \
    -c:v libx264 -preset veryfast -b:v 3000k -maxrate 3000k -bufsize 6000k \
    -framerate 25 -video_size 1280x720 -vf "format=yuv420p" -g 50 -shortest -strict experimental \
    -c:a aac -b:a 128k -ar 44100 \
    -f flv rtmp://localhost/live/my-stream

i.e. video.mp4 is spinning in a loop and from the playlist.txt file I play mp3 in turn.
With this everything is ok, everything works. But I also want to show the title of the playing track.
As for example on some YouTube radios:
ytb
enter image description here

With cover is perfect!

Any ideas how this can be implemented?

I know that it is possible to display text through drawtext. You can output text from a file, which you can separately update yourself. But how to get the data of the currently playing file? ffmpeg does not give such information, only stream parameters: fps, framerate... Or is it still possible to get it?

Or are there better and easier ways?

Thanks in advance for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情仇皆在手 2025-02-13 13:10:11

您可以使用 ffprobe 从文件中提取元数据。

you can use FFprobe to extract metadata from files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文