Reputation: 680
I'm trying to livestream by ffmpeg using static image and audio file. The ffmpeg command like this
ffmpeg -re -loop 1 -f image2 -i '/tmp/11.jpg' -f lavfi -i amovie=/tmp/5117.mp3:loop=999 -video_size 600x480 -c:v libx264 -x264-params keyint=60 -bufsize 500k -c:a aac -ar 44100 -b:a 128k -r 30 -g 60 -pix_fmt yuv420p -f flv "rtmp://"
/tmp/11.jpg was generated by another process and keep updated twice per second. The ffmpeg command doesn't look right, first, it show status like this
frame= 85 fps=9.4 q=29.0 size= 2261kB time=00:02:24.19 bitrate= 128.4kbits/s speed= 16x
As you see, 16x is not good, 1x is the right value for livestream. Then, after a while, it show many warning log like this
[flv @ 0x322bd60] Non-monotonous DTS in output stream 0:1; previous: 335993, current: 297752; changing to 335993. This may result in incorrect timestamps in the output file.
Please help to fix it.
Upvotes: 1
Views: 5551
Reputation: 93028
The movie filters don't reset timestamps, which accounts for the DTS warnings by the FLV muxer. You can slow the output video processing by using the realtime filter.
ffmpeg -loop 1 -f image2 -i '/tmp/11.jpg'
-f lavfi -i amovie=/tmp/5117.mp3:loop=999,asetpts=N/SR/TB
-vf realtime,scale=600:480,format=yuv420p
-r 30 -g 60 -c:v libx264 -x264-params keyint=60 -bufsize 500k
-c:a aac -ar 44100 -b:a 128k -f flv "rtmp://"
Upvotes: 2