out of memory when concatenate Audio Files with ffmpeg - audio

I use ffmpeg to concatenate 70 audio files
this is the command ... when XXXX the number if the audio files.
Each audio file has delay.
When i trying to do it with about 30 audio files ( or less then 30 ) - it work good
But with 70 ( or more ) its crash with out of memory
How to solve it ?
"-i", "/storage/input1.wav", "-i", "/storage/input2.wav" ..... , "-filter_complex", "[1]adelay=8000|8000[s1];[1]adelay=125000|125000[s2] .... ;[0][s1][s2] .... amix=XXXX[mixout]" -map "[mixout]" "/storage/output.wav"

Related

What does profile means in an aac encoded audio

I am trying to concat two video files with ffmpeg concat demuxer for most of the part it works just fine!
But when I try to concat videos which has two different audio profile with same codec, it concats with the resulting video having weird sound problem. And when re-encoding the resulting video it will spit out a lots of error related to audio.
Here is ffprobe output for some audio stream from different video files
Video 1
[STREAM]
index=1
codec_name=aac
codec_long_name=unknown
profile=4
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
...
[/STREAM]
Video 2
[STREAM]
index=1
codec_name=aac
codec_long_name=unknown
profile=1
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
...
[/STREAM]
Video 3
[STREAM]
index=1
codec_name=aac
codec_long_name=unknown
profile=28
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
...
[/STREAM]
Look the different profile= values.I was able to reproduce 28 and 1 but was failed for 4
28 = he_aac_v2 1 = ffmpeg default
So what I want to know the most is,
What does these different values mean for aac?
And how to reproduce them with any aac encode?
According to libavcodec/avcodec.h:
FF_PROFILE_AAC_MAIN 0
FF_PROFILE_AAC_LOW 1
FF_PROFILE_AAC_SSR 2
FF_PROFILE_AAC_LTP 3
FF_PROFILE_AAC_HE 4
FF_PROFILE_AAC_HE_V2 28
FF_PROFILE_AAC_LD 22
FF_PROFILE_AAC_ELD 38
The native FFmpeg AAC encoder (-c:a aac) does not have the ability to output HE or HEv2 profiles.
If you need HE profile (-profile:a 4 or -profile:a aac_he) you'll have to use another encoder, such as -c:a libfdk_aac, -c:a aac_at (macOS/iOS only), or a separate standalone AAC encoder.

FFMpeg - Segment audio to chunks

I have tried this example in order to segment a given video file using ffmpeg into an m3u8 file and smaller chunks (.ts files). This actually worked great. Is it possible to do practically the same thing with audio input?
This was my most promising approach so far (capturing live audio on Windows OS):
ffmpeg -f dshow -i audio="<name of input device>" -acodec libmp3lame -ab 64000 | segmenter - 10 stream stream.m3u8 http://<IP_OF_SERVER>/stream/stream/ 5 1
But this returns this error:
At least one output file must be specified.
Could not open input file, make sure it is an mpegts file: -1
I really would not know how to convert the live audio stream to an mpegts file.
Could anyone please give me a hint?
Thanks a lot

ffmpeg encode audio multi thread

I am using ffmpeg to convert a video file that have h264 ready video track , and DTS audio track .
I run cmd attempt : copy the video track and convert DTS to AAC , but when check activity monitor , number of threads used by ffmpeg only 1 , although i set threads param to 4
ffmpeg -i titanic.mkv -map 0:0 -map 0:1 -c:v:0 copy -c:a:0 libfaac -threads 4 titanic.m4v
how can i make ffmpeg to utilize all my machine core , so it can use many thread as possible to increase conversion speed, when convert audio track only.
Thank and regard

Big file conversion .ogv to .avi ogv2avi on Ubuntu

I'm trying to convert a 200MB .ogv file to .avi with a script I found online:
#!/bin/bash
# ogv to avi
# Call this with multiple arguments
# for example : ls *.{ogv,OGV} | xargs ogv2avi
N=$#;
echo "Converting $N files !"
for ((i=0; i<=(N-1); i++))
do
echo "converting" $1
filename=${1%.*}
mencoder "$1" -ovc xvid -oac mp3lame -xvidencopts pass=1 -o $filename.avi
shift 1
done
After this all I have to do is $ ogv2avi name_of_file.ogv
and it creates the converted.avi file.
It works great for small file, but it seems to crash for big files, and I only get around the first 3 minutes of the 30 minute recording.
Too many audio packets in the buffer: (4096 in 850860 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
Flushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 16384:10142.
Setting audio delay to 0.078s.
Video stream: 784.308 kbit/s (98038 B/s) size: 21254748 bytes 216.800 secs 3000 frames
Audio stream: 87.341 kbit/s (10917 B/s) size: 2372536 bytes 217.313 secs
I had the exact same problem, and the only way i got around it (a sloppy solution but it works) is to play the .ogv video on the Ubuntu Desktop and record the square were the video is located with a desktop recorder that don't produces .ogv files(I recommend Kazam which produces .webm files). Then use Audacity to edit the audio of the output video if necessary and mix the edited audio with the output video using MkvMerge.

Export each minute of MP3 into separate WAV

This is definitely a strange question but I'm looking for a way to split an mp3 mix of 60 minutes into 60 separate 1 minute long wav files to use with an audio fingerprinting API like Echonest.
Is this possible in a single ffmpeg command or would I have to run multiple iterations of ffmpeg with a the following values:
-ss is the startpoint in seconds.
-t is the duration in seconds.
You can use the segment muxer in ffmpeg:
ffmpeg -i input.mp3 -codec copy -map 0 -f segment -segment_time 60 output%03d.mp3
For a 4 minute input this results in:
$ ls -m1 output*.mp3
output000.mp3
output001.mp3
output002.mp3
output003.mp3
Since -codec copy enables stream copy mode re-encoding will be avoided. See the segment documentation for more information and examples.

Resources