[FFmpeg-user] Error during conversion of MP4 to WAV
Pierre Frenkiel
frenkiel at gmail.com
Wed Apr 5 12:09:22 EEST 2023
hi,
try my 2 following scripts: mp4tomp3 and mp3towav
============ mp4tomp3 ==================================================
#!/bin/bash
#?: usage: mp4tomp3 [-d] file.mp4 [ file2.mp4 ... ]
#?: convert mp4 to mp3
#?: -d: delete mp4 file after conversion
#?:
[[ -f /etc/setenv ]] && . /etc/setenv
[[ $1 = -h ]] && xhelp $0
[[ -n $DBG ]] && set $DBG
unset DEL
if [[ $1 = -d ]]; then
DEL=true
shift
fi
for F in $*
do
FN=${F%.mp4}
ffmpeg -i $FN.mp4 -acodec libmp3lame -ab 256k $FN.mp3 || exit 1
touch -r $F $FN.mp3
[[ -n $DEL ]] && rm -f $F
done
=============== mp3towav ==========================================
#!/bin/bash
#?: usage: mp3towav [options] infile[.mp3]
#?: infile: file name
#?: output is infile.wav
#?: options
#?: -n: normalize the output file
#?: -g gain: add this option to normalize-mp3
#?: -rm: remove mp3 file if no error
#?: examples:
#?: mp3towav in
#?: mp3towav in.mp3
. /etc/setenv
[[ $1 = -h || $1 = --help ]] && xhelp $0
[[ -n $DBG ]] && set $DBG
unset NORM RM
unset GAIN
while true
do
case $1 in
-n)
NORM=true
shift
;;
-g)
GAIN="-g $2"
shift 2
;;
-rm)
RM=true
shift
;;
*)
break
;;
esac
done
typeset -l OUT
F=$1
IN=${F%.mp3}.mp3
[[ -f $IN ]] || mexit mp3towav 1 "$IN not found"
IND=`dirname $F`
OUT=${IND}/`fname $IN`.wav
if [[ -f $OUT ]]; then
cpb $OUT
rm -f $OUT
fi
lame --replaygain-accurate --preset medium $IN $OUT || exit 1
touch -r $IN $OUT
[[ -n $RM ]] && rm -f $IN
[[ -z $NORM ]] && exit 0
norm $GAIN $OUT
=========================================================
Pierre Frenkiel
On Wed, 5 Apr 2023, Nicolas George wrote:
> Alexander Gorodetski (12023-04-05):
>> I have MP4 file audio encoded with g722.1 (I do not know the reason why MP4
>> was created in such a strange way).
>>
>> In any case I am trying to convert the MP4 file to WAV format and I receive
>> the following strange message. It seems that ffmpeg does not support the
>> g722.1 audio format. What can be a solution to this problem?
>
> Hi.
>
> Do you know at least one software that can read that file?
>
> Regards,
>
> --
> Nicolas George
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-user
mailing list