soreil / audio Goto Github PK
View Code? Open in Web Editor NEWAudio package to go along with the image package in helping the thumbnailers needs.
Audio package to go along with the image package in helping the thumbnailers needs.
Where there is no bitrate set for a stream we use the avformatcontext bitrate or none at all, the formatcontext bitrate also includes side data like images. This is evident from an opus file with a JPG image and the exact same audio with a different PNG file having different (too high) bitrates.
--- PASS: TestConstruct (0.16s)
audio_test.go:41:
audio_test.go:42: Filename: exampleFalse.mp3
audio_test.go:49: Failed to create decoder No input data provided
audio_test.go:41:
audio_test.go:42: Filename: exampleImage.mp3
audio_test.go:53: Audio duration: 59.559184s
audio_test.go:54: Audio format: mp3
audio_test.go:55: Bitrate: 192 kbps
audio_test.go:58: Image format: jpeg
audio_test.go:60: Picture length: 103 k
audio_test.go:41:
audio_test.go:42: Filename: exampleTrue.mp3
audio_test.go:53: Audio duration: 59.559184s
audio_test.go:54: Audio format: mp3
audio_test.go:55: Bitrate: 192 kbps
audio_test.go:41:
audio_test.go:42: Filename: mpthreetest.mp3
audio_test.go:53: Audio duration: 12.416125s
audio_test.go:54: Audio format: mp3
audio_test.go:55: Bitrate: 128 kbps
audio_test.go:41:
audio_test.go:42: Filename: examplePNG.mp3
audio_test.go:53: Audio duration: 59.559184s
audio_test.go:54: Audio format: mp3
audio_test.go:55: Bitrate: 192 kbps
audio_test.go:58: Image format: png
audio_test.go:60: Picture length: 213 k
audio_test.go:41:
audio_test.go:42: Filename: exampleFalse.ogg
audio_test.go:49: Failed to create decoder No input data provided
audio_test.go:41:
audio_test.go:42: Filename: exampleJPG.ogg
audio_test.go:53: Audio duration: 6.104036s
audio_test.go:54: Audio format: vorbis
audio_test.go:55: Bitrate: 160 kbps
audio_test.go:58: Image format: jpeg
audio_test.go:60: Picture length: 103 k
audio_test.go:41:
audio_test.go:42: Filename: examplePNG.ogg
audio_test.go:53: Audio duration: 6.104036s
audio_test.go:54: Audio format: vorbis
audio_test.go:55: Bitrate: 160 kbps
audio_test.go:58: Image format: png
audio_test.go:60: Picture length: 213 k
audio_test.go:41:
audio_test.go:42: Filename: exampleTrue.ogg
audio_test.go:53: Audio duration: 6.104036s
audio_test.go:54: Audio format: vorbis
audio_test.go:55: Bitrate: 160 kbps
audio_test.go:41:
audio_test.go:42: Filename: exampleJPG.opus
audio_test.go:53: Audio duration: 2.92s
audio_test.go:54: Audio format: opus
audio_test.go:55: Bitrate: 0 kbps
audio_test.go:58: Image format: jpeg
audio_test.go:60: Picture length: 103 k
audio_test.go:41:
audio_test.go:42: Filename: examplePNG.opus
audio_test.go:53: Audio duration: 2.92s
audio_test.go:54: Audio format: opus
audio_test.go:55: Bitrate: 0 kbps
audio_test.go:58: Image format: png
audio_test.go:60: Picture length: 213 k
audio_test.go:41:
audio_test.go:42: Filename: exampleTrue2.opus
audio_test.go:53: Audio duration: 2.92s
audio_test.go:54: Audio format: opus
audio_test.go:55: Bitrate: 0 kbps
audio_test.go:41:
audio_test.go:42: Filename: exampleTrue.opus
audio_test.go:53: Audio duration: 3m48.114083s
audio_test.go:54: Audio format: opus
audio_test.go:55: Bitrate: 0 kbps
audio_test.go:41:
audio_test.go:42: Filename: traincrash.webm
audio_test.go:53: Audio duration: 1m0.913s
audio_test.go:54: Audio format: opus
audio_test.go:55: Bitrate: 0 kbps
audio_test.go:41:
audio_test.go:42: Filename: test.webm
audio_test.go:41:
audio_test.go:42: Filename: slam.webm
audio_test.go:53: Audio duration: 2m1.703s
audio_test.go:54: Audio format: vorbis
audio_test.go:55: Bitrate: 0 kbps
audio_test.go:41:
audio_test.go:42: Filename: aacTest.mp4
audio_test.go:53: Audio duration: 5m7.479s
audio_test.go:54: Audio format: aac
audio_test.go:55: Bitrate: 63 kbps
audio_test.go:41:
audio_test.go:42: Filename: aacTest.aac
audio_test.go:53: Audio duration: 7m31.334374s
audio_test.go:54: Audio format: aac
audio_test.go:55: Bitrate: 95 kbps
audio_test.go:41:
audio_test.go:42: Filename: itunes.m4a
audio_test.go:53: Audio duration: 5m7.525079s
audio_test.go:54: Audio format: aac
audio_test.go:55: Bitrate: 128 kbps
Related to Soreil/video/issues/7
# github.com/Soreil/audio
In file included from ../../go/src/github.com/Soreil/audio/ffmpeg.go:8:0,
from $WORK/github.com/Soreil/audio/_obj/_cgo_export.c:3:
/usr/local/include/libavformat/avformat.h:880:21: note: declared here
AVCodecContext *codec;
^
# github.com/Soreil/audio
../../go/src/github.com/Soreil/audio/ffmpeg.go: In function ‘get_codecContext’:
../../go/src/github.com/Soreil/audio/ffmpeg.go:59:2: warning: ‘codec’ is deprecated [-Wdeprecated-declarations]
AVCodecContext * codecCtx = ctx->streams[strm]->codec;
^
In file included from ../../go/src/github.com/Soreil/audio/ffmpeg.go:8:0:
/usr/local/include/libavformat/avformat.h:880:21: note: declared here
AVCodecContext *codec;
^
The 4096 buffer size is sufficient for all files except some odd Opus test files I had, not all opus files exhibit this behaviour and the same file without attached images does not exhibit it either.
I need to go from 4096 way up to 256k or even 512k. This smells like a bug somewhere.
It is already not there in the AVFormatContext, might be incorrectly setting up the AVIOContext or probing the data.
./ffmpeg.go:283: cannot use unsafe.Pointer(c) (type unsafe.Pointer) as type *C.struct_AVCodecContext in argument to func literal
./ffmpeg.go:293: cannot use unsafe.Pointer(c) (type unsafe.Pointer) as type *C.struct_AVCodecContext in argument to func literal
./ffmpeg.go:309: cannot use unsafe.Pointer(c) (type unsafe.Pointer) as type *C.struct_AVCodecContext in argument to func literal
FAIL github.com/Soreil/audio [build failed]
This will mean slightly expanding the interface but it will hopefully result in much lower memory pressure and in general less memory work being done by C.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.