[FFmpeg-user] ffmpeg HIGH CPU, http streaming with libmp3lame

Ted Park kumowoon1025 at gmail.com
Wed Feb 6 10:59:28 EET 2019

> On Feb 5, 2019, at 3:05 PM, Zoltan Kerenyi Nagy <kerenyi.nagy.zoltan at gmail.com> wrote:
> I see, however do you think it is normal that recording to 300 sec wav
> segments digests 4% CPU, in contrast with streaming with mp3 conversion and
> recording to wav at the same time digest 90-100% CPU on an ARM7 device
> which has 4 cores an 625 Mhz CPU and 256MB ram?

Probably not, even if there was an increase it shouldn’t be much more than twice at its worst

> On Feb 5, 2019, at 12:15 PM, Zoltan Kerenyi Nagy <kerenyi.nagy.zoltan at gmail.com> wrote:
> The CPU usage is still abobe 90% with libshine. Do you think that something
> is buggy with my script?
> https://pastebin.com/dyHK6ATh <https://pastebin.com/dyHK6ATh>

> #!/bin/bash
> folder="/home/$USER/recordings"
> ffserver -f /etc/ffserver.conf &
> sleep 2
> mkfifo /tmp/fifo1 2>/dev/null
> mkdir -p "$folder"
> while true;do
>     day=$(date '+%Y-%m-%d')
>     mkdir -p "$folder"/"$day"
>     ffmpeg -f alsa -i hw:0,0 http://localhost:4444/audio.ffm -f wav pipe:1 > /tmp/fifo1 &
>     ffmpeg -i /tmp/fifo1 -ss 0 -t 300 -ar 44100 "$folder"/"$day"/"$(date '+%Y-%m-%d__%H_%M')".wav
> done
> exit 0

Does this script work? I am suspicious of the while loop with the fifo. Pretty sure it wouldn’t do what you want, there would be a break in the audio every five minutes. Maybe you could use the segment muxer?

ffmpeg -f alsa -i hw:0,0 http://localhost:4444/audio.ffm <http://localhost:4444/audio.ffm> -ar 44100 -f segment -strftime 1 -segment_time 300 %Y-%m-%d__%H_%M.wav

Only thing is it wouldn’t create the directory structure.

More information about the ffmpeg-user mailing list