Uses 654K of libraries. Click here for Pure Java version (1942L/13K/45K).
1 | !7 |
2 | |
3 | lib 1006985 // JAAD for AAC decoding |
4 | |
5 | import net.sourceforge.jaad.mp4.*; |
6 | import net.sourceforge.jaad.mp4.api.*; |
7 | import net.sourceforge.jaad.mp4.api.Frame; |
8 | import net.sourceforge.jaad.aac.*; |
9 | |
10 | p { |
11 | File file = getProgramFile(#1006739, "Prince - Motherless Child - Live!-99Q31nyH16w.m4a"); |
12 | assertTrue("Please run #1006739", file.exists()); |
13 | |
14 | fixContextClassLoader(); |
15 | MP4Container container = new MP4Container(new RandomAccessFile(file, "r")); |
16 | Movie movie = container.getMovie(); |
17 | List<Track> tracks = movie.getTracks(AudioTrack.AudioCodec.AAC); |
18 | if (tracks.size() > 0) { |
19 | Track track = tracks.get(0); |
20 | |
21 | byte[] decoderSpecificInfo = track.getDecoderSpecificInfo(); |
22 | Decoder dec = new Decoder(decoderSpecificInfo); |
23 | |
24 | new SampleBuffer buf; |
25 | Frame frame; |
26 | while not null (frame = track.readNextFrame()) { |
27 | dec.decodeFrame(frame.getData(), buf); |
28 | byte[] audio = buf.getData(); |
29 | print("Got audio: " + l(audio) + " channels: " + buf.getChannels() + " bits/sample: " + buf.getBitsPerSample() + " " + (buf.isBigEndian() ? "big endian" : "little endian") + ", " + buf.getSampleRate() + " hz"); |
30 | } |
31 | } |
32 | print("Got " + n(tracks, "tracks")); |
33 | } |
Began life as a copy of #1006984
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006986 |
Snippet name: | Test reading .m4a [dev.] |
Eternal ID of this version: | #1006986/15 |
Text MD5: | e6a967742749e86ceacde426c5d44e46 |
Transpilation MD5: | aad555e7235ef27d46f14a2e7a1cc56a |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-02-22 00:08:00 |
Source code size: | 1220 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 484 / 597 |
Version history: | 14 change(s) |
Referenced in: | [show references] |