Старожилы, подскажите плиз, как можно массово извлечь звук из видео файлов? Есть папка с клипами, к примеру в формате mp4, нужно извлечь в mp3. Графические способы я нашел, а как в консоли нет. Для одного файла нашел примеры, а как применить к данной папке?
LinuxForum.Fans
Как массово извлечь звук из видео файлов
Автор: dm2003
7 сообщений
5307 просмотров
Как-то так (запускать в каталоге с файлами mp4)
text
#!/bin/bash
for i in *.mp4; do ffmpeg -i ${i} -vn -ar 44100 -ac 2 -ab 192 -f mp3 ${i%.mp4}.mp3; done
mkdir -p AUDIO
mv *.mp3 AUDIO/
Создал скрипт. Поместил его в сценарии. Зашел в нужную папку. ПКМ запустил скрипт. Создалась папка AUDIO и все. Что сделал не так?
Покажите вывод скрипта. Установлен ли ffmpeg?
P.S. Это был пример, который необходимо допилить до нужного функционала.
В программе WinFF все прекрасно работает. Значит ffmpeg установлен.
Показать
dm@dm-System-Product-Name:~/Рабочий стол/12345$ #!/bin/bash
dm@dm-System-Product-Name:~/Рабочий стол/12345$ for i in *.mp4; do ffmpeg -i ${i} -vn -ar 44100 -ac 2 -ab 192 -f mp3 ${i%.mp4}.mp3; done
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:36 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Akcent: No such file or directory
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:36 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Aligator: No such file or directory
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:36 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Amir: No such file or directory
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:36 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Azis: No such file or directory
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:36 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Chlöe: No such file or directory
dm@dm-System-Product-Name:~/Рабочий стол/12345$ mkdir -p AUDIO
dm@dm-System-Product-Name:~/Рабочий стол/12345$ mv *.mp3 AUDIO/
dm@dm-System-Product-Name:~/Рабочий стол/12345$ for i in *.mp4; do ffmpeg -i ${i} -vn -ar 44100 -ac 2 -ab 192 -f mp3 ${i%.mp4}.mp3; done
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:36 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Akcent: No such file or directory
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:36 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Aligator: No such file or directory
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:36 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Amir: No such file or directory
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:36 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Azis: No such file or directory
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:36 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Chlöe: No such file or directory
dm@dm-System-Product-Name:~/Рабочий стол/12345$ mkdir -p AUDIO
dm@dm-System-Product-Name:~/Рабочий стол/12345$ mv *.mp3 AUDIO/
В итоге скрипт получился вот такой:
text
#!/bin/sh
mkdir cash
for f in *.avi *MOV *.mkv *.mp4 *.mpg ;
do
ffmpeg -i "$f" -vn -ar 44100 -ac 2 -ab 192k -f mp3 cash/"${f%.*}".mp3
doneВойдите или зарегистрируйтесь, чтобы ответить.