FFMPEG Combining images to video and streaming in one command line

こ雲淡風輕ζ 提交于 2019-12-23 04:48:05

问题


Currently, using ffmpeg, I am using two commands on my Terminal to:

1) create a video from a bunch of images:

ffmpeg -r 60 -f image2 -s 1920x1080 -i rotated-pano_frame%05d_color_corrected_gradblend.jpg -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4

2) stream the video to a udp address:

ffmpeg -re -i test.mp4 -c copy -f flv udp://127.0.0.1:48550

How can I combine these two commands, into one single ffmpeg command?

A concern I have is that it takes a couple of minutes to generate the video from the images. Therefore, these commands have to happen serially, whereby the second command waits a few minutes for the first command to be completed, before it ensues.


回答1:


Just add && between the two commands. This will execute the second command if the first executes successfully.

ffmpeg -r 60 -f image2 -s 1920x1080 -i rotated-pano_frame%05d_color_corrected_gradblend.jpg -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4 && ffmpeg -re -i test.mp4 -c copy -f flv udp://127.0.0.1:48550


来源:https://stackoverflow.com/questions/45060462/ffmpeg-combining-images-to-video-and-streaming-in-one-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!