简体   繁体   English

ffmpeg mp4 转换带有子目录的脚本

[英]ffmpeg mp4 convert script with sub directories

I have a folder with multiple subfolders with mkv files我有一个包含多个子文件夹的文件夹,其中包含 mkv 文件

main directory主目录

then然后

Directory A Dir B Dir C Dir D Dir E Dir F Dir G目录 A 目录 B 目录 C 目录 D 目录 E 目录 F 目录 G

I need a script that will search all directories for.mkv and convert to.mp4我需要一个脚本来搜索.mkv 的所有目录并转换为.mp4

i currently have this script我目前有这个脚本

for file in *.mkv; do ffmpeg -i "$file" -c:a aac -q:a 2 -c:v copy "${file%.m kv}.mp4"; done

but it only works if the.sh file is placed in each dir但它仅在将 .sh 文件放在每个目录中时才有效

Use find :使用find

find . -type f -name "*.mkv" -exec ffmpeg -y -i {} -c:a aac -q:a 2 -c:v copy {}.mp4 \;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM