FFMPEG command for audio file streaming

18,973

I could figure out the way to stream an audio file using FFMPEG. The command for the same is given below:

ffmpeg -re -f mp3 -i sender.mp3 -acodec libmp3lame -ab 128k -ac 2 -ar 44100 -f rtp rtp://10.14.35.23

Here the audio file 'sender.mp3' is located in the same folder as ffmpeg.exe. In case of a different folder, the full path should be mentioned in the command.

Share:
18,973

Related videos on Youtube

Vigo
Author by

Vigo

Updated on June 04, 2022

Comments

  • Vigo
    Vigo almost 2 years

    I am trying to stream an audio file in mp3 format using the FFMPEG library to a remote computer, located on the same LAN as the sender. The command i used to stream at the sender is given below:

    ffmpeg -re -f mp3 -i sender.mp3 -ar 8000 -f mulaw -f rtp rtp://10.14.35.23:1234
    

    I got the below command on FFMPEG documentation page that generates audio and streams it to port number 1234 on remote computer

    ffmpeg -re -f lavfi -i aevalsrc="sin(400*2*PI*t)" -ar 8000 -f mulaw -f rtp rtp://10.14.35.23:1234
    

    I thought i had made relevant changes to this so that the mp3 streaming command will work, but only to know encounter the error which reads
    "Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height"

    Can anyone tell me what is the wrong parameter here and how to rectify it?

  • Davide
    Davide almost 6 years
    Doesn't work: Option re (read input at native frame rate) cannot be applied to output url rtp://127.0.0.1:1111 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. Error parsing options for output file rtp://127.0.0.1:1111. Error opening output files: Invalid argument