转换rmvb成PSP能播放的MP4的脚本
#!/bin/bash
# Install mencoder & gpac first
# sudo apt-get install mencoder gpac
# Movie file extension definition
extension="rmvb"
for movie in $(ls *.${extension})
do
movie=${movie%.*}
if [ -f "${movie}.mp4" ]; then
echo "$movie.$extension has been converted, ignore..."
else
echo "convert $movie.$extension to mp4..."
mencoder "$movie.$extension" -sws 9 -af volnorm -srate 48000 -vf-add scale=362:272,harddup -ofps 24000/1001 -oac faac -faacopts br=96:mpeg=4:object=2 -ovc x264 -ffourcc H264 -x264encopts crf=22:level_idc=21:bframes=3:frameref=2:nopsnr:nossim -o "${movie}.temp.avi" >& /dev/null
mencoder -ovc copy -nosound -of rawvideo -o "${movie}.temp.264" "${movie}.temp.avi"
mencoder -ovc frameno -oac copy -of rawaudio -o "${movie}.temp.aac" "${movie}.temp.avi"
MP4Box -fps 23.976 -add "${movie}.temp.264"#video -add "${movie}.temp.aac"#audio -new "${movie}.mp4"
rm -f "${movie}.temp.avi"
rm -f "${movie}.temp.264"
rm -f "${movie}.temp.aac"
fi
done
# Install mencoder & gpac first
# sudo apt-get install mencoder gpac
# Movie file extension definition
extension="rmvb"
for movie in $(ls *.${extension})
do
movie=${movie%.*}
if [ -f "${movie}.mp4" ]; then
echo "$movie.$extension has been converted, ignore..."
else
echo "convert $movie.$extension to mp4..."
mencoder "$movie.$extension" -sws 9 -af volnorm -srate 48000 -vf-add scale=362:272,harddup -ofps 24000/1001 -oac faac -faacopts br=96:mpeg=4:object=2 -ovc x264 -ffourcc H264 -x264encopts crf=22:level_idc=21:bframes=3:frameref=2:nopsnr:nossim -o "${movie}.temp.avi" >& /dev/null
mencoder -ovc copy -nosound -of rawvideo -o "${movie}.temp.264" "${movie}.temp.avi"
mencoder -ovc frameno -oac copy -of rawaudio -o "${movie}.temp.aac" "${movie}.temp.avi"
MP4Box -fps 23.976 -add "${movie}.temp.264"#video -add "${movie}.temp.aac"#audio -new "${movie}.mp4"
rm -f "${movie}.temp.avi"
rm -f "${movie}.temp.264"
rm -f "${movie}.temp.aac"
fi
done
从这个脚本可以看到,直接使用mencoder生成MP4是有问题的,因为mencoder对MP4的封装有问题,PSP无法识别,所以后来要用MP4Box重新封装MP4文件。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步