Estou tentando executar um script para extrair todo o áudio de um monte de arquivos MP4. Tudo funciona quando eu faço isso linha por linha recortando e colando do meu editor de texto no terminal, mas quando eu crio um shell script para fazer isso, eu recebo um conjunto de erros, se eu cortar e colar várias linhas, eu recebo um erro diferente .
Eu posso criar um loop foreach para fazer isso, mas tentando entender o que está errado. Aqui está parte do script de shell:
#/bin/bash
ffmpeg -i 969_BIO03.1-Introduction-to-Molecular-Genetics.mp4 -b:a 192K -vn BIO03.1-Introduction-to-Molecular-Genetics.mp3
ffmpeg -i 970_BIO03.2-DNA-Replication.mp4 -b:a 192K -vn BIO03.2-DNA-Replication.mp3
ffmpeg -i 971_BIO03.3-DNA-Repair.mp4 -b:a 192K -vn BIO03.3-DNA-Repair.mp3
ffmpeg -i 972_BIO03.4-Transcription.mp4 -b:a 192K -vn BIO03.4-Transcription.mp3
Novamente, se eu copiar apenas uma linha, tudo estará bem. Se eu executar o script, obtenho:
# ./ripaudio.sh
ffmpeg version N-52501-gd783297 Copyright (c) 2000-2013 the FFmpeg developers
built on May 14 2013 15:57:34 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
libavutil 52. 27.101 / 52. 27.101
libavcodec 55. 6.100 / 55. 6.100
libavformat 55. 3.100 / 55. 3.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 60.102 / 3. 60.102
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '969_BIO03.1-Introduction-to-Molecular-Genetics.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.3.100
Duration: 00:08:30.49, start: 0.021333, bitrate: 733 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 596 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
handler_name : SoundHandler
'NULL @ 0x243c8c0] Unable to find a suitable output format for 'BIO03.1-Introduction-to-Molecular-Genetics.mp3
: Invalid argumenton-to-Molecular-Genetics.mp3
ffmpeg version N-52501-gd783297 Copyright (c) 2000-2013 the FFmpeg developers
built on May 14 2013 15:57:34 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
libavutil 52. 27.101 / 52. 27.101
libavcodec 55. 6.100 / 55. 6.100
libavformat 55. 3.100 / 55. 3.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 60.102 / 3. 60.102
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '970_BIO03.2-DNA-Replication.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.3.100
Duration: 00:27:38.52, start: 0.021333, bitrate: 709 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 572 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
handler_name : SoundHandler
'NULL @ 0x357b8a0] Unable to find a suitable output format for 'BIO03.2-DNA-Replication.mp3
: Invalid argumentation.mp3
Se eu, então, pegar um grupo de 3 ou mais e colá-los, obtenho isto:
ffmpeg -i 974_BIO05.2-Prokaryotes.mp4 -b:a 192K -vn BIO05.2-Prokaryotes.mp3
ffmpeg version N-52501-gd783297 Copyright (c) 2000-2013 the FFmpeg developers
built on May 14 2013 15:57:34 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
libavutil 52. 27.101 / 52. 27.101
libavcodec 55. 6.100 / 55. 6.100
libavformat 55. 3.100 / 55. 3.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 60.102 / 3. 60.102
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '974_BIO05.2-Prokaryotes.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.3.100
Duration: 00:21:53.75, start: 0.021333, bitrate: 708 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 571 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
handler_name : SoundHandler
Output #0, mp3, to 'BIO05.2-Prokaryotes.mp3':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
TSSE : Lavf55.3.100
Stream #0:0(eng): Audio: mp3, 48000 Hz, stereo, fltp, 192 kb/s
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:1 -> #0:0 (aac -> libmp3lame)
Press [q] to stop, [?] for help
stream #1:390kB time=00:00:16.58 bitrate= 192.6kbits/s
keyframe=1
duration=0.021
dts=332.480 pts=332.480
size=375
stream #1:
keyframe=1
duration=0.021
dts=332.501 pts=332.501
size=355
[trimmed out hundreds of lines of this repeating pattern]
stream #1:
keyframe=1
duration=0.021
dts=337.109 pts=337.109
size=364
stream #1:
keyframe=1
duration=0.021
dts=337.131 pts=337.131
size=318
Enter command: <target> <time> <command>[ <argument>]
Parse error, at least 3 arguments were expected, only 1 given in string 'ell.mp4 -b:a 192K -vn BIO06.1-Anatomy-of-the-Cell.mp3'
size= 8408kB time=00:05:58.70 bitrate= 192.0kbits/s
Enter command: <target> <time> <command>[ <argument>]
Estou apenas tentando entender o que deu errado aqui, escrevi um número decente de scripts ao longo dos anos, e a única coisa sobre o Unix é que sempre é consistente. seu roteiro pode estar quebrado, mas é consistente com isso até que você tenha o comando certo.
Estou usando o SecureCRT como um cliente de terminal.