Hi,
Could we know how ffmpeg determine audio channel number from MP4 file? MP4
container indicates it's channel count is 2, but ffprobe shows mono as
expected.
--
I use ffmpeg to convert a audio into mono by the following command:
ffmpeg -y -t 30 -i audio.mp4 -dn -sn -vn -map 0 -c:a libfdk_aac -b:a 48k
-ar 44100 -ac 1 audio_48k_mono.mp4
Then I use ffprobe to check the file. It shows the audio stream is mono
(channels: 1).
-
{
streams: [
{
index: 0,
codec_name: aac,
codec_long_name: AAC (Advanced Audio Coding),
codec_type: audio,
codec_time_base: 1/44100,
codec_tag_string: mp4a,
codec_tag: 0x6134706d,
sample_fmt: fltp,
sample_rate: 44100,
channels: 1,
channel_layout: mono,
bits_per_sample: 0,
r_frame_rate: 0/0,
avg_frame_rate: 0/0,
time_base: 1/44100,
start_pts: -2048,
start_time: -0.046440,
duration_ts: 1325048,
duration: 30.046440,
bit_rate: 48085,
nb_frames: 1294,
disposition: {
default: 1,
dub: 0,
original: 0,
comment: 0,
lyrics: 0,
karaoke: 0,
forced: 0,
hearing_impaired: 0,
visual_impaired: 0,
clean_effects: 0,
attached_pic: 0
},
tags: {
language: und,
handler_name: SoundHandler
}
}
],
format: {
filename: INTERNET_tid_9900011_m_audio_48k_mono.mp4,
nb_streams: 1,
nb_programs: 0,
format_name: mov,mp4,m4a,3gp,3g2,mj2,
format_long_name: QuickTime / MOV,
start_time: -0.046440,
duration: 30.047000,
size: 186776,
bit_rate: 49729,
probe_score: 100,
tags: {
major_brand: isom,
minor_version: 512,
compatible_brands: isomiso2mp41,
title: Big Buck Bunny,
artist: Blender Foundation 2008, Janus Bager Kristensen
2013,
composer: Sacha Goedegebure,
encoder: Lavf55.48.100,
comment: sourceURL=http://www.bigbuckbunny.org/;,
genre: Animation
}
}
}
--
And I also use Bento4's mp4dump to check the file. But in stsd box, it
says channel_count:2. Are there something wrong?
---
[
{
name:ftyp,
header_size:8,
size:28,
major_brand:isom,
minor_version:512,
compatible_brand:isom,
compatible_brand:iso2,
compatible_brand:mp41
},
{
name:free,
header_size:8,
size:8
},
{
name:mdat,
header_size:8,
size:180608
},
{
name:moov,
header_size:8,
size:6132,
children:[
{
name:mvhd,
header_size:12,
size:108,
timescale:1000,
duration:30047,
duration(ms):30047
},
{
name:trak,
header_size:8,
size:5668,
children:[
{
name:tkhd,
header_size:12,
size:92,
enabled:1,
id:1,
duration:30047,
width:0.00,
height:0.00
},
{
name:edts,
header_size:8,
size:36,
children:[
{
name:elst,
header_size:12,
size:28,
entry count:1,
entry/segment duration:3,
entry/media time:2048,
entry/media rate:1
}]
},
{
name:mdia,
header_size:8,
size:5532,
children:[
{
name:mdhd,
header_size:12,
size:32,
timescale:44100,
duration:1325048,
duration(ms):30046,
language:und
},
{
name:hdlr,
header_size:12,
size:45,
handler_type:soun,
handler_name:SoundHandler
},
{
name:minf,
header_size:8,
size:5447,
children:[
{
name:smhd,
header_size:12,
size:16,
balance:0
},
{
name:dinf,
header_size:8,
size:36,
children:[
{
name:dref,
header_size:12,
size:28,
children:[
{
name:url ,
header_size:12,
size:12,
location:[local to file]
}]
}]
},
{
name:stbl,
header_size:8,
size:5387,
children:[
{
name:stsd,
header_size:12,
size:103,
entry-count:1,
children:[
{
name:mp4a,
header_size:8,
size:87,
data_reference_index:1,
channel_count:2,
sample_size:16,
sample_rate:44100,
children:[
{
name:esds,