InDashPC.org Forum Index InDashPC.org
In Dash Car PC forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PyMedia - aac decoding problem

 
Post new topic   Reply to topic    InDashPC.org Forum Index -> Software
View previous topic :: View next topic  
Author Message
votx



Joined: 12 Jan 2009
Posts: 3

PostPosted: Mon Jan 12, 2009 3:22 pm    Post subject: PyMedia - aac decoding problem Reply with quote

I'm having some trouble decoding aac audio streams from video
files. ffmpeg shows the audio stream in the video as follows :

Code:
   Stream #0.0(und): Audio: aac, 44100 Hz, stereo, s16


But when I try to run some of the examples, like demux_audio_video.py,
on the video, they die with various errors. For example running

Code:

   python demux_audio_video.py video.mp4 foo


dies with this error :

Code:

   Traceback (most recent call last):
     File "demux_audio_video.py", line 30, in <module>
       demuxVideo( sys.argv[ 1 ], sys.argv[ 2 ] )
     File "demux_audio_video.py", line 12, in demuxVideo
       v= filter( lambda x: x[ 'type' ]== muxer.CODEC_TYPE_AUDIO, dm.streams )
     File "demux_audio_video.py", line 12, in <lambda>
       v= filter( lambda x: x[ 'type' ]== muxer.CODEC_TYPE_AUDIO, dm.streams )
   TypeError: 'NoneType' object is unsubscriptable


This error is caused because dm.streams[ 1 ] has no [ 'type' ]
attribute and hence causes the unsubscriptable error, where
dm.streams[ 1 ] is the aac audio stream. What then happens is when I
create a decoder based on this stream, like :

Code:
   audiodecoder = pymedia.audio.acodec.Decoder ( dm.streams[ 1 ] )


and then call

Code:
   audioframe = audiodecoder.decode( d[ 1 ] )


audioframe is None and hence an error occurred somehow. This is
confusing, though, because when I

Code:
   print 'codec id: ' + str( pymedia.audio.acodec.getCodecID( 'aac' ) )


It properly spits out :

Code:
   codec id: 86018

which is the right codec id for the aac decoder ( same as ffmpeg ).


The demux_audio_video.py script works fine on other files ( like an
avi file whos audio is mp3 encoded ). I think the problem stems from
pymedia somehow not having access to an aac decoder? This is puzzling
because when I installed pymedia I also installed the latest libfaad and
libfaac before it. Then when I built and installed pymedia the setup.py script
seemed to properly find and recognize FAAD :

Code:
   OGG          : found
   VORBIS       : found
   FAAD         : found
   MP3LAME      : found
   VORBISENC    : found
   ALSA         : found


Are there any other specific flags that must be enabled when building
pymedia to enable aac encoding/decoding? I made sure line 251 in
setup.py was _not_ commented out :

Code:
   dep('FAAD', 'libfaad2', 'faad.h', 'libfaad', 'CONFIG_FAAD').configure(inc_hunt,lib_hunt),


Any ideas? Thanks so much!
Back to top
View user's profile Send private message
votx



Joined: 12 Jan 2009
Posts: 3

PostPosted: Tue Jan 13, 2009 10:56 pm    Post subject: Reply with quote

As a follow up to try and see if I could get around this error, I started over completely from scratch with a fresh install of CentOS 5.2.

I went through all of the motions again for installing ffmpeg and pymedia, making sure to install faad, faad-devel, faac, and faac-devel before building pymedia.

[Very] Sadly... no dice. Same error with pymedia ( while ffmpeg still has no problems ).

Any ideas?
Back to top
View user's profile Send private message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Wed Jan 14, 2009 12:59 pm    Post subject: Reply with quote

Try to see if avi has the same problem ?
Back to top
View user's profile Send private message
votx



Joined: 12 Jan 2009
Posts: 3

PostPosted: Wed Jan 14, 2009 2:10 pm    Post subject: Reply with quote

jbors wrote:
Try to see if avi has the same problem ?


Thanks for the response jbors.

I have tried the scripts ( like demux_audio_video.py and some of my own ) on avi's and they work without a problem. Though one thing to note is that the audio in the avi's I tested has been mp3 encoded and not aac encoded.

And actually upon further inspection, it may be demuxing the mp4 that is the problem. I ran demux_audio_video.py on another mp4 file with mp3 encoded audio and I got the same unsubscriptable object error trace as I did with the different mp4 with aac encoded audio.

This means it may be an mp4 demuxing problem instead of an aac decoding problem. Hmm...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    InDashPC.org Forum Index -> Software All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group