开发者

Recording a mp3 stream with FFMPEG and drop-outs

I hope someone can give me pointer, I have a php script that runs the command below to record an live radio mp3 stream to create hour long mp3 recordings. It works very well for my purpose. The only issue is occasionally no recording is made. As far as I can tell its because the stream has dropped out and ffmpeg just aborts.

/usr/local/bin/ffmpeg -i http://www.mystream.com:8000/radiostream.mp3 -t 60:00 -acodec copy /var/www/mydomain/audio/".$recorded_audio_title;

So my question, is there anyway to tell ffmpeg to continuously record for the 60:00 minutes to make a recording even if their are drop outs? I'd be happy with a odd bit of silence providing it completed the recording.

I hope this makes sense 开发者_开发百科and I'd appreciate even a pointer to a FFMPEG option or flag. Having Google'd I havnt seen anything that would fit the bill.

Many thanks in advance

rob


Assuming you need to record exactly 60 mins files by completing dropped streaming by silence.

FFMPEG doesn't have such explicit option. But you can simulate it. Prepare 60 mins mp3 of silence. Record your stream. When recording finished, check its duration. If it's shorter than 60 mins - join your recording with silence file and specify that final duration should be 60 mins. Joining is described here.

EDIT:

To continue recording you just need to check your previous recording duration and if it's too short - run the same FFMPEG command again, with different file name, and then join two files. Loop this until you receive 60 mins file


try looking at ffmpeg -segment command to split up your audio recording into 60 minute chunks ffmpeg documentation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜