我正在尝试使用 FFmpeg 将音频(或视频)源保存到本地。以下是我使用的命令和参数。
ffmpeg -i http://7359.live.streamtheworld.com:80/CONTINENTALAAC_SC -vn -ar 22050 -acodec flac -ss 0 -t 6000 test1.flac
然后我在 Bash 中对其进行迭代,但是一个文件的结尾和下一个文件的结尾之间存在重叠。
有没有办法每 10 分钟分块提供一次信息?
这是 t shell 输出:
ffmpeg -i http://7359.live.streamtheworld.com:80/CONTINENTALAAC_SC -vn -ar 22050 -acodec flac -ss 0 -t 6 test1.flac
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 29 2012 23:56:18 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' --enable-avfilter --enable-avfilter-lavf --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
[aac @ 0x928e850]max_analyze_duration reached
[aac @ 0x928e850]Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'http://7359.live.streamtheworld.com:80/CONTINENTALAAC_SC':
Duration: N/A, bitrate: 29 kb/s
Stream #0.0: Audio: aac, 44100 Hz, 2 channels (FC), s16, 29 kb/s
File 'test1.flac' already exists. Overwrite ? [y/N] y
Output #0, flac, to 'test1.flac':
Metadata:
encoder : Lavf52.64.2
Stream #0.0: Audio: flac, 22050 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 175kB time=6.06 bitrate= 236.6kbits/s
video:0kB audio:167kB global headers:0kB muxing overhead 4.824872%
控制台打印出 LordNeckbeard 建议的新参数:
ffmpeg -i http://7359.live.streamtheworld.com:80/CONTINENTALAAC_SC -vn -codec:a flac -map 0 -f segment -segment_list out.list -segment_time 00:10:00.00 out%03d.flac
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 29 2012 23:56:18 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' --enable-avfilter --enable-avfilter-lavf --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
[aac @ 0x8c8e850]max_analyze_duration reached
[aac @ 0x8c8e850]Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'http://7359.live.streamtheworld.com:80/CONTINENTALAAC_SC':
Duration: N/A, bitrate: 23 kb/s
Stream #0.0: Audio: aac, 44100 Hz, 2 channels (FC), s16, 23 kb/s
Unrecognized option 'codec:a'
答案1
尝试分段复用器。
ffmpeg -i input -vn -codec:a flac -map 0 -f segment -segment_list out.list \
-segment_time 00:10:00.00 out%03d.flac
值得考虑复制音频流而不是重新编码,但如果没有 ffmpeg 控制台输出,就不可能提供非猜测的示例。