In ActionScript 3, I use SoundMixer.computeSpectrum() to takes a snapshot of the current sound wave playing on the stage and places it into the specified ByteArray object.
I want to write the ByteArray into FFMPEG (by std -i pipe:0), but the ByteArray object created is fixed to 512 floating-point values and FFMPEG seem doesn't support that value. The sound in the output is corrupted.
Here's a part of my code in AS3:
Code:stage.addEventListener(Event.ENTER_FRAME, update); function update(e:Event):void{ var soundBA:ByteArray = new ByteArray(); SoundMixer.computeSpectrum(soundBA, false, 0); process.standardInput.writeBytes(soundBA); }
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 4 of 4
Thread
-
-
You could: truncate your float to a precision that ffmpeg DOES support, probably the 64bit one, as that is highest. 64bit float is VERY VERY high precision/dynamic range, so should not be losing any value of data.
Though on 2nd thought, it sounds like the "512" bytes is the stereo packet size, with each byte being a (-1 to +1) sample. And the example shown on that page mentions using 32bit float, so maybe that's the one you should choose. Try both endian versions - one will be much better than the other ("signal" vs. "noise/static").
Actionscript 3, wow.
Scott -
Hornestly, I don't know whether "512 floating-point values" is the packet size or the bit-depth of the sound sample.
If it is the packet size (so it point out the "duration"/ how many samples in one snapshot ByteArray), how can I know the bit-depth?
The document doesn't tell me clearly about this. Although its example shown that "The sound bytes are read as 32-bit floating-point number from the byte stream", it can be forced to do so and I don't know how the raw audio bit-depth is.
Do you have any ideas about this? -
There is no way that these are 512 bit floating point data types, cpu's are not capable, under normal circumstances, of processing 512 bit data types, regardless of whether or not it's an int or a float.
For the record:
short = 16 bit
int = 32 bit
long = 32 bit
float = 32 bit
double = 64 bit
Then you have the SIMD data types which for SSE are 128 bit, AVX are 256 bit AVX-512 are 512 bit.
I think you are confusing 2 very different things.
Similar Threads
-
Does YT-DLP or FFMPEG Merge The Raw Encrypted Fragments
By SoConfused in forum Video Streaming DownloadingReplies: 1Last Post: 14th Jun 2021, 16:21 -
Subtitle Workshop gives floating point divide by zero error opening videos.
By bizzybody in forum SubtitleReplies: 2Last Post: 26th Feb 2021, 01:15 -
How do I pass values from FFProbe to FFmpeg?
By Bassquake in forum ProgrammingReplies: 12Last Post: 10th Feb 2021, 09:39 -
Capturing ffmpeg RAW or Lossless Video & Audio
By TubeBar in forum Video Streaming DownloadingReplies: 3Last Post: 24th May 2018, 01:11 -
FFMPEG: how to extract audio from a specific timecode point?
By marcorocchini in forum Newbie / General discussionsReplies: 8Last Post: 2nd Jul 2017, 11:38