How to capture audio streaming with ffmpeg - ffmpeg

I'd like to capture audio streaming from a live radio on internet using ffmpeg.
If you have some examples or documentation it will be very appreciated.

Assuming the protocol is HTTP and audio format is MP3 it can be as simple as:
ffmpeg -i http://server:port -c copy output.mp3
See:
FFmpeg Protocols Documentation
ffmpeg Documentation: Stream copy

Related

Ffmpeg -c copy not carrying over audio track from mkv to hls stream

I am using ffmpeg to create an hls stream. The source is an mkv with multiple audio tracks. I have tried using -map to specify the audio stream as well. I also found that when I point ffmpeg to any other audio stream in the file it works. It's just the first audio stream that does not. At one point I replaced -c copy with -acodec aac -ac 6 on the first stream and I got sound which is great but I am only looking to copy the stream and not re-encode it. The next thing I tried was using other mkv videos I have. All are reflecting the same issue. The mkv's by itself play both audio and video fine in VLC. When playing the output.m3u8 in VLC the option to choose different audio tracks is greyed out. Here is the command I'm using:
ffmpeg -i "./video.mkv" -ss 00:00:00 -t 00:00:30 -c copy -f hls "output.m3u8"
I want the audio of my hls stream to reflect that of the mkv source:
Although what I get returned from the command above gives me no sound and shows me this in mediaInfo:
I've aslo noticed that hls does not support pcm. Is it possible dash could work with this stream because it is pcm?
HLS segments can be either MPEG-TS or fragmented MP4. Neither officially support PCM audio, so you'll have to convert it.
DASH uses fragmented MP4 as segment format.

FFMPEG RTSP streaming

I need help with ffmpeg streaming. I have a Grandstream GSC3510 Speaker that it also works like a telephone. I need to configure a rtsp server for streaming 1 file or mutiple files (if possible) of music. I tried straming with UDP that worked but only RSTP format can be streamed and if a call comes in, interupted while call is in place and then continued when the call is over.
my code for udp worked fine:
ffmpeg -stream_loop -1 -re -i C:\relax.mp3 -vol 30 -filter_complex aresample=16000,asetnsamples=n=160 -acodec g722 -ac 1 -vn -f rtp udp://239.255.255.241:5555
but I cant get RTSP to work Im kind of a new at this so I would really appreciate some help.
Please try the live555 RTSP streaming server to stream the data to grand stream speaker.

How to decode G.729b codec?

I am developing an application that listens for RTP data using GStreamer and converts the received raw data packets using FFMPEG.
I works well for codes: PCMA, PCMU, G722 and G729 and converts the received audio files into wav and mp3. But the conversion fails when G729b packet is received. FFMPEG has support for G729 as mentioned here but nothing is mentioned about G729a/b. GStreamer also has not mentioned anything about G729a/b though has a decoder for G729. I also didn't find any other library that can convert G729b to wav or mp3.
Can anyone please suggest any way or any library to convert G729a/b to wav.
Thanks in advance!
Command used:
ffmpeg -f g729 -i .g729 -acodec pcm_s16le -ar 8000 output.wav
Please find the two files here

Capturing and processing a live RTMP stream

I'm trying to download a live stream (not a file) coming from a live camera feed available at the following website: http://www.dot.ca.gov/video/.
I used Wireshark for sniffing the TCP packets and was able to extract the RTMP parameters, but wasn't able to use them with FFMPEG/VLC for downloading / playing the stream on VLC (I guess I didn't construct the URL correctly).
for example, for the camera feed available here, I got the following parameters:
swfUrl: http://www.dot.ca.gov/research/its/StrobeMediaPlayback.swf
pageUrl: http://www.dot.ca.gov/d4/d4cameras/ct-cam-pop- N17_at_Saratoga_Rd.html
tcUrl: rtmp://wzmedia.dot.ca.gov:1935/D4
Play : E37_at_Lakeville_Rd.stream.
Is there a chance someone is familiar with this and can help with understanding how I can use the above for downloading the stream?
Thanks a lot! Yaniv
ffmpeg -re -i "rtmp://wzmedia.dot.ca.gov:1935/D4" -acodec copy -vcodec libx264 -f flv -y ~/save_stream.flv
"-i " means infile and "-y" means overwrite output files.
you can use ffmpeg -h to see it.

Copying audio stream from a source file to a trancoded video file using ffmpeg

I have built my own video-only transcoder using ffmpeg without audio. I do not want to transcode the audio. What will be best way to add the audio stream from the source file to the transcoded file using FFMPEG API?
Try -acodec copy, e.g. something like this:
ffmpeg -i your_input.file [your video transcoding options] -acodec copy your_output.file

Resources