[FFmpeg-trac] #8538(ffmpeg:new): -ar and -ac don't appear to work with stream_specifier > 0
FFmpeg
trac at avcodec.org
Tue Feb 25 08:46:04 EET 2020
#8538: -ar and -ac don't appear to work with stream_specifier > 0
---------------------------------+----------------------------------
Reporter: cdhowie | Type: defect
Status: new | Priority: normal
Component: ffmpeg | Version: 4.2
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
---------------------------------+----------------------------------
'''Summary of the bug:'''
When using ffmpeg to generate an HLS output with multiple renditions,
-ar:0 and -ac:0 work to set the audio sample rate and channel count of the
first output stream.
-ar:1, -ac:1, -ar:2, -ac:2, etc. do not cause any errors but also appear
to have no effect; the rate and channel count from the input stream is
used for all but the first HLS output stream.
-ar and -ac (without stream specifiers) will set the rate and channel
count for all output streams correctly.
The particular input file does not appear to be relevant. This same
behavior is produced with every input file I have tried.
'''How to reproduce:'''
{{{
$ ffmpeg -version
ffmpeg version 4.2.2-static https://johnvansickle.com/ffmpeg/ Copyright
(c) 2000-2019 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-
debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio
--cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp
--enable-libgme --enable-gray --enable-libaom --enable-libfribidi
--enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt
--enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid
--enable-libzvbi --enable-libzimg
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
}}}
{{{
% ffmpeg -i input.mp4
...
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2013-06-05T23:42:03.000000Z
com.apple.finalcutstudio.media.uuid: 05AC8CB0-598D-
4DF0-8719-8D71EE88135E
com.apple.finalcutstudio.media.history.uuid: 4A73B189-408C-416E-
93D3-5216E8AEF0A7
timecode : 00:00:00:00
Duration: 00:04:52.90, start: 0.000000, bitrate: 8344 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv,
bt709), 1280x720, 8227 kb/s, 30 fps, 30 tbr, 3k tbn, 6k tbc (default)
Metadata:
creation_time : 2013-06-05T23:53:26.000000Z
handler_name : Apple Video Media Handler
encoder : H.264
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 112 kb/s (default)
Metadata:
creation_time : 2013-06-05T23:53:26.000000Z
handler_name : Apple Sound Media Handler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2013-06-05T23:53:38.000000Z
handler_name : Time Code Media Handler
timecode : 00:00:00:00
}}}
{{{
% ffmpeg -y -fflags +genpts+igndts+ignidx -i input.mp4 -fflags
+genpts+igndts+ignidx -t 00:05:00 \
-preset slow \
-force_key_frames 'expr:gte(t,n_forced*2)' \
-sc_threshold 0 \
-c:v h264 \
-c:a aac \
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 \
-profile:v:0 high -b:v:0 3000k -maxrate:v:0 3200k -bufsize:v:0
4500k -b:a:0 128k -ac:0 1 -ar:0 48000 -filter:v:0
'fps=fps=30,format=yuv420p,scale=-2:720' \
-profile:v:1 baseline -b:v:1 1500k -maxrate:v:1 1600k -bufsize:v:1
2250k -b:a:1 128k -ac:1 1 -ar:1 48000 -filter:v:1
'fps=fps=30,format=yuv420p,scale=-2:480' \
-profile:v:2 baseline -b:v:2 1200k -maxrate:v:2 1280k -bufsize:v:2
1800k -b:a:2 96k -ac:2 1 -ar:2 48000 -filter:v:2
'fps=fps=30,format=yuv420p,scale=-2:360' \
-var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2" \
-master_pl_name master.m3u8 \
-f hls -hls_time 6 -hls_playlist_type vod \
-hls_segment_filename "out/a/v%v/playlist%04d.ts" \
"out/a/v%v/playlist.m3u8"
...
Output #0, hls, to 'out/a/v%v/playlist.m3u8':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
timecode : 00:00:00:00
com.apple.finalcutstudio.media.uuid: 05AC8CB0-598D-
4DF0-8719-8D71EE88135E
com.apple.finalcutstudio.media.history.uuid: 4A73B189-408C-416E-
93D3-5216E8AEF0A7
encoder : Lavf58.29.100
Stream #0:0(eng): Video: h264 (libx264), yuv420p(progressive),
1280x720, q=-1--1, 3000 kb/s, 30 fps, 90k tbn, 30 tbc (default)
Metadata:
creation_time : 2013-06-05T23:53:26.000000Z
handler_name : Apple Video Media Handler
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 3200000/0/3000000 buffer size: 4500000
vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC), 48000 Hz, mono, fltp, 128 kb/s
(default)
Metadata:
creation_time : 2013-06-05T23:53:26.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.54.100 aac
Stream #0:2(eng): Video: h264 (libx264), yuv420p(progressive),
854x480, q=-1--1, 1500 kb/s, 30 fps, 90k tbn, 30 tbc (default)
Metadata:
creation_time : 2013-06-05T23:53:26.000000Z
handler_name : Apple Video Media Handler
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 1600000/0/1500000 buffer size: 2250000
vbv_delay: -1
Stream #0:3(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s
(default)
Metadata:
creation_time : 2013-06-05T23:53:26.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.54.100 aac
Stream #0:4(eng): Video: h264 (libx264), yuv420p(progressive),
640x360, q=-1--1, 1200 kb/s, 30 fps, 90k tbn, 30 tbc (default)
Metadata:
creation_time : 2013-06-05T23:53:26.000000Z
handler_name : Apple Video Media Handler
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 1280000/0/1200000 buffer size: 1800000
vbv_delay: -1
Stream #0:5(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 96 kb/s
(default)
Metadata:
creation_time : 2013-06-05T23:53:26.000000Z
handler_name : Apple Sound Media Handler
encoder : Lavc58.54.100 aac
}}}
Note that the first output stream is 48kHz and mono, but the second two
are 44.1kHz and mono in contradiction to the supplied arguments. The
ffmpeg manpage (as well as ffmpeg's lack of an error on these arguments)
would seem to indicate that this should work.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8538>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list