0

I'm generating an MPEG transport stream from a PNG file with ffmpeg succesfully with the following command:

ffmpeg -re -loop 1 -i smpte-color-bars-1080p.png -r 25 -vcodec libx264 -tune zerolatency -f mpegts udp://0.0.0.0:1234

I'd like to add an audio track to this usingthe sine function but am falling at the first hurdle.

I've tried:

ffmpeg -re -loop 1 -i smpte-color-bars-1080p.png -r 25 -vcodec libx264 -tune zerolatency -i sine=frequency=1000 -f mpegts udp://0.0.0.0:1234

and get the error:

Unknown decoder 'libx264'

Which implies that my arguments order is wrong.

So I then tried:

ffmpeg -re -loop 1 -i sine=frequency=1000 -i smpte-color-bars-1080p.png -r 25 -vcodec libx264 -tune zerolatency -f mpegts udp://0.0.0.0:1234

and get the error:

sine=frequency=1000: No such file or directory

What is the correct syntax for adding a sine generated audio in this case?

0

sine is a source filter, so the input format needs to be set as a filter using -f lavfi.

Use

ffmpeg -re -loop 1 -i smpte-color-bars-1080p.png -re -f lavfi -i sine=frequency=1000 -r 25 -vcodec libx264 -tune zerolatency -acodec aac -f mpegts udp://0.0.0.0:1234

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.