Re: [FFmpeg-user] Use ffmpeg to convert stereo audio to mono

2014-12-05 Thread Moritz Barsnick
 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.

ffprobe probably looks at the actual AAC stream?

Here's a hint:
http://sourceforge.net/p/opencore-amr/mailman/message/31876733/

The cause for this is that libavformat always writes 2 as number of 
channels in the m4a header regardless of the actual stream.
(This was about HE-AAC, but may be valid here as well.)

Is this causing any issues except your trust in the nature of the file?

I must say I'm not sure whether that is actually true, whether it's
okay for ffmpeg to do so, and whether this is still valid with recent
ffmpeg. I can confirm the behavior though.

Moritz

P.S.: I like adding other tools to the confusion, without knowing
what they look at:

$ mediainfo audio_48k_mono.mp4 | grep -Fi chann
Channel(s)   : 2 channels
Channel(s)_Original  : 1 channel
Channel positions: Front: C
$ mplayer -vo null -ao null audio_48k_mono.mp4 2/dev/null | grep -F AUDIO
AUDIO: 44100 Hz, 1 ch, s16le, 48.3 kbit/6.85% (ratio: 6040-88200)
$ # vlc says: Codec - Stream 0 - Channels: Stereo
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


Re: [FFmpeg-user] Use ffmpeg to convert stereo audio to mono

2014-12-05 Thread Christian Ebert
* Moritz Barsnick on Friday, December 05, 2014 at 10:37:14 +0100
 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.
 
 ffprobe probably looks at the actual AAC stream?
 
 Here's a hint:
 http://sourceforge.net/p/opencore-amr/mailman/message/31876733/
 
 The cause for this is that libavformat always writes 2 as number of 
 channels in the m4a header regardless of the actual stream.
 (This was about HE-AAC, but may be valid here as well.)
 
 Is this causing any issues except your trust in the nature of the file?
 
 I must say I'm not sure whether that is actually true, whether it's
 okay for ffmpeg to do so, and whether this is still valid with recent
 ffmpeg. I can confirm the behavior though.
 
 Moritz
 
 P.S.: I like adding other tools to the confusion, without knowing
 what they look at:
 
 $ mediainfo audio_48k_mono.mp4 | grep -Fi chann
 Channel(s)   : 2 channels
 Channel(s)_Original  : 1 channel
 Channel positions: Front: C
 $ mplayer -vo null -ao null audio_48k_mono.mp4 2/dev/null | grep -F AUDIO
 AUDIO: 44100 Hz, 1 ch, s16le, 48.3 kbit/6.85% (ratio: 6040-88200)
 $ # vlc says: Codec - Stream 0 - Channels: Stereo

There's more confusion:
https://trac.ffmpeg.org/ticket/4106

-- 
Auftreten Tarzan und Martha -
ich hatte Sankt Pauli unterschätzt.

_MICHAEL WEBER: MARTHA_ --- http://www.blacktrash.org/baustellen/#martha
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


[FFmpeg-user] Use ffmpeg to convert stereo audio to mono

2014-12-04 Thread Wesley Wen
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,