Page 1 of 1

bash script ffmpeg for aac audio get exactly 4 second

Posted: Wed Mar 13, 2019 12:50 pm
by dominiques
please help me get exactly 00:04:00 second audio aac files using ffmpeg it is splitting 1 file to 4 sec fragments....

but i need exactly 00:04:00 second

100% working my work:

Code: Select all

# mp4 video folder 
# temp DIR_TMP=/home/tv/Desktop/prepare/temp 

# final cutted 4 second audio aac 
mkdir -p $DIR_IN $DIR_TMP $DIR_OUT cd $DIR_IN 
for file in *.mp4 
echo "Extracting the whole audio-track from $file to $DIR_TMP/${file%.mp4}.aac" 
ffmpeg -i "$file" -vn -acodec copy $DIR_TMP/"${file%.mp4}.aac" 

echo "Splitting the large video-file $file to a smaller audio-files '${file%.mp4}'XXX.aac" 

ffmpeg -i $DIR_TMP/"${file%.mp4}.aac" -c copy -f segment -segment_time 4 $DIR_TMP/"${file%.mp4}%03d.aac" rm -f $DIR_TMP/"${file%.mp4}.aac" 
done this working but its not exactly 4 seconds its about 3:57 seconds for example
please help