edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB8dbd683Tahinli3 months ago856 commits
| 1 | //! Wraps a bare ADTS stream (the SBR patch-map probes' |
| 2 | //! `scripts/aac-tables/sbrpatchmap.py` output) in an mp4 container carrying |
| 3 | //! an EXPLICIT-SBR AudioSpecificConfig as its `esds` -- the instrument |
| 4 | //! round-30's blocker needed: a bare `.aac` file carries no out-of-band |
| 5 | //! AudioSpecificConfig at all, so a decoder that trusts one (rather than |
| 6 | //! only its bare-ADTS implicit per-frame SBR detection) has nothing to arm |
| 7 | //! HE-AAC output from and locks to core-rate. |
| 8 | //! |
| 9 | //! Matroska was tried first (`MatroskaMuxer`, dev-dep already proven to |
| 10 | //! round-trip `CodecPrivate` byte-for-byte in |
| 11 | //! `crates/ec-aac/tests/sbr_real_library.rs`) but the reference decoder's |
| 12 | //! Matroska demuxer reads the *codec ID string* ("A_AAC" vs. |
| 13 | //! "A_AAC/MPEG4/SBR") for its reported profile, not just the `CodecPrivate` |
| 14 | //! bytes our `MatroskaMuxer` writes generically -- it still upgraded the |
| 15 | //! reported sample rate to the extension rate (proving it DOES parse |
| 16 | //! `CodecPrivate` for that), but kept reporting profile "LC". mp4's `esds` |
| 17 | //! carries the same explicit-SBR AudioSpecificConfig and needs no such |
| 18 | //! sibling string, matching the real `~/Music/reeln.mp4` fixture's |
| 19 | //! own container exactly. |
| 20 | //! |
| 21 | //! `stream()`/`stream_one_band()`'s probe frames are full ADTS (7-byte |
| 22 | //! header + raw_data_block); this strips the header off each frame and |
| 23 | //! remuxes the raw access units into an mp4 track whose `esds` is |
| 24 | //! `write_audio_specific_config` with `object_type = AOT_SBR` and an |
| 25 | //! explicit `extension_sample_rate`. |
| 26 | //! |
| 27 | //! usage: wrap_sbr_mkv <in.aac> <core_rate> <ext_rate> <channels> <out.mp4> |
| 28 | use File; |
| 29 | |
| 30 | use ; |
| 31 | use |
| 32 | |
| 33 | |
| 34 | ; |
| 35 | use Mp4Muxer; |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 |