Невозможно перекодировать аудиопоток с другим битрейтом, используя ffmpeg

1398
Visionscaper

Аналогичный вопрос был задан в другом месте без удовлетворительного ответа для меня .

Следующая команда ffmpeg приводит к ошибке. Когда добавляется «-c: копия», чтобы просто скопировать аудиопоток, видеопоток красиво перекодируется с запрошенным битрейтом.

Я запускаю это на OS X Yosemite 10.10.2.

Как устранить эту ошибку?

ffmpeg -i input.mp4 -b:v 8M -b:a 10k output.mp4 ffmpeg version 1.0.1 Copyright (c) 2000-2012 the FFmpeg developers built on Dec 7 2012 09:31:51 with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --arch=x86_64 --enable-runtime-cpudetect libavutil 51. 73.101 / 51. 73.101 libavcodec 54. 59.100 / 54. 59.100 libavformat 54. 29.104 / 54. 29.104 libavdevice 54. 2.101 / 54. 2.101 libavfilter 3. 17.100 / 3. 17.100 libswscale 2. 1.101 / 2. 1.101 libswresample 0. 15.100 / 0. 15.100 libpostproc 52. 0.100 / 52. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: mp41mp42isom creation_time : 2015-02-06 08:37:52 Duration: 00:00:48.04, start: 0.000000, bitrate: 12332 kb/s Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x960 [SAR 1:1 DAR 2:1], 12201 kb/s, 14.98 fps, 14.99 tbr, 600 tbn, 1200 tbc Metadata: creation_time : 2015-02-06 08:37:52 handler_name : Core Media Video Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, s16, 125 kb/s Metadata: creation_time : 2015-02-06 08:37:52 handler_name : Core Media Audio [libx264 @ 0x7fbbba009c00] using SAR=1/1 [libx264 @ 0x7fbbba009c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64 [libx264 @ 0x7fbbba009c00] profile High, level 4.0 [libx264 @ 0x7fbbba009c00] 264 - core 128 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=14 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=8000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [NULL @ 0x7fbbba00aa00] Codec is experimental but experimental codecs are not enabled, try -strict -2 Output #0, mp4, to 'output.mp4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: mp41mp42isom Stream #0:0(und): Video: h264, yuv420p, 1920x960 [SAR 1:1 DAR 2:1], q=-1--1, 8000 kb/s, 90k tbn, 14.99 tbc Metadata: creation_time : 2015-02-06 08:37:52 handler_name : Core Media Video Stream #0:1(und): Audio: none, 44100 Hz, mono, flt, 10 kb/s Metadata: creation_time : 2015-02-06 08:37:52 handler_name : Core Media Audio Stream mapping: Stream #0:0 -> #0:0 (h264 -> libx264) Stream #0:1 -> #0:1 (aac -> aac) Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height 
1

1 ответ на вопрос

3
slhck

Here's your error:

Codec is experimental but experimental codecs are not enabled, try -strict -2

When converting to MP4, ffmpeg tries to choose an AAC audio encoder. Since your ffmpeg is not compiled with libfaac, libfdk-aac or libvo-aacenc, all of which are third party encoders, it defaults to the internal AAC encoder (called aac).

However, this encoder is considered experimental and will only run when you add -strict -2 or -strict experimental to the options.

Some notes:

  • You are trying 10 kBit/s as audio bitrate which is much too low for the built-in AAC-LC encoder. This bitrate would only work for HE-AAC v2, which libfdk-aac could do. And it'd still sound bad.

  • In general, I would always explicitly specify the encoder you want to use. Saves you a bit of trouble when the defaults are not sane.

  • I'd recommend you update your ffmpeg version to something more recent, either by downloading a static build, or compiling it yourself. When you compile, you have the choice of using libfdk-aac, which offers better quality than aac, and also has a proper VBR option.

  • Please read the AAC encoding guide for more info.

Ха-ха, 10 кбит / с было потому, что я экспериментировал с настройками;) Visionscaper 9 лет назад 0