علیرضا
علیرضا

Reputation: 2642

ffmpeg stream an audio file to Telegram rtmp server

I tried to stream an mp3 file to a Telegram RTMP live using the following command:

ffmpeg -re -i 1.mp3 -c copy -f mp3 rtmps://dc4-1.rtmp.t.me/s/145158:AtyF3rrME2nHEkqGA

But I couldn't hear any sound in the stream.

Upvotes: 0

Views: 8060

Answers (2)

Calanor
Calanor

Reputation: 41

Change -f mp3 by -f flv.

Example:

ffmpeg -re -i 1.mp3 -c:a copy -f flv rtmps://dc4-1.rtmp.t.me/s/145158:AtyF3rrME2nHEkqGA

Upvotes: 0

Roj
Roj

Reputation: 1342

You should specify the codecs explicitly.

The following is the simplest working command:

ffmpeg -i your_input -c:v libx264 -c:a aac -f flv rtmps://dcx-y.rtmp.t.me/s/YOUR_KEY

Here is a more advanced example from @tgbeta:

ffmpeg -stream_loop -1 -re -i your_input -c:v libx264 -preset veryfast -b:v 3500k -maxrate 3500k -bufsize 7000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv rtmps://dcx-y.rtmp.t.me/s/YOUR_KEY

Upvotes: 8

Related Questions