Giter Club home page Giter Club logo

Comments (21)

devongovett avatar devongovett commented on July 21, 2024

In the case of MP3 it might work. Normally we need the beginning of the file since container formats usually provide format info at the beginning. MP3 is weird in that it doesn't really have a container format, so the demuxer just looks for the first valid MP3 frame. Maybe your chunk sizes aren't big enough? If it doesn't find anything in the first chunk it receives, it won't look further.

Another option, is since you know it is MP3 just skip the demuxer all together and go straight to the decoder. This would require slightly more work on your part, but you could basically subclass the MP3Demuxer (MP3Demuxer.extend) and override the probe class method to just return true, and remember to call AV.Demuxer.register(YourSubclass). Honestly I'm not sure what will happen, I've never tried streaming stuff, so let me know how it goes.

Try increasing your chunk size from (I assume) your custom source first, then try the custom demuxer idea...

from aurora.js.

fabslab avatar fabslab commented on July 21, 2024

I changed the MP3.js file while testing to just return true in the probe function (for now, instead of extending the class).
Now it tries to decode it but for every chunk it throws the AV.UnderflowError each time. It gets as far as this line
https://github.com/audiocogs/mp3.js/blob/master/src/header.js#L267 in MP3FrameHeader.decode before failing the Stream.prototype.available function in aurora.

from aurora.js.

devongovett avatar devongovett commented on July 21, 2024

Yeah sounds like a chunk size issue maybe. Is it possible for you to increase it? What does your source look like?

from aurora.js.

fabslab avatar fabslab commented on July 21, 2024

Audio is coming from FFmpeg sending the audio through HTTP to a server that's relaying that audio over WebSocket to aurora. Have to experiment with FFmpeg options I think.

from aurora.js.

asherawelan avatar asherawelan commented on July 21, 2024

I'm working on this same issue:- using ffmpeg, data arrives into mp3.js, but not much else:-
Tried:-
ffmpeg -loglevel debug -re -i mind-explosion-1.mp4 -f mp3 -chunk_size 105k http://127.0.0.1:8081;

Tried with and without -re and changed chunk_size to various sizes, nada. Any advise welcomed.

from aurora.js.

asherawelan avatar asherawelan commented on July 21, 2024

Server is very simple setup:

var http = require('http');
var connect = require('connect');
var ws = require('ws');

// Consume the ffmpeg audio stream
var audio_consumer = http.createServer( function(req, res) {
    console.log('Audio Stream Connected: ' + req.socket.remoteAddress);
    req.on('data', function(data){
        //When video data arrives, send to all the producer's clients
        for (var i in audio_producer.clients){
            audio_producer.clients[i].send(data, {binary:true});
        };
    });

    req.on('end', function () {
        res.end("Thanks");
    }); 

    req.on('error', function(e) {
        console.log("ERROR ERROR: " + e.message);
    });
}).listen(8081, "127.0.0.1");


var audio_producer = new ws.Server({port: 8071});
audio_producer.on('connection', function(socket) {

    console.log('Audio Client Connected'); 

    socket.on('close', function(code, message){
        console.log( 'Disconnected Audio WebSocket ('+audio_producer.clients.length+' total)' );
    });
});

console.log('Awaiting ws Audio Connections on http://127.0.0.1:8071/');

from aurora.js.

devongovett avatar devongovett commented on July 21, 2024

@asherawelan what does your client side code look like? I assume you implemented some sort of web socket source. I've actually never tried this with aurora, so I'm interested in getting this working.

from aurora.js.

asherawelan avatar asherawelan commented on July 21, 2024

Here it is :)

<html><head>
<meta charset="utf-8">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="js/aurora.js"></script>
<script type="text/javascript" src="js/aurora-websocket.min.js"></script>
<script type="text/javascript" src="js/mp3.js"></script>

<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
    AV.Player.fromWebSocket('ws://vixen.awelan.com:8071').play();
});
//]]>
</script>

</head>
<body>
<div id="container">
MP3 should stream here...
</body>
</html>

from aurora.js.

fabslab avatar fabslab commented on July 21, 2024

It seems no matter how many bytes are coming through it keeps failing the Stream.prototype.available test. It's often by just 1 byte more.

from aurora.js.

devongovett avatar devongovett commented on July 21, 2024

I looked at that code you linked to in mp3.js above where you are seeing the error, and have a possible explanation. That code is looking for the next frame after the current one, which is apparently not loaded yet. Or perhaps because the next frame hasn't been encoded yet since it is streaming, looking for the next frame there is wrong. I'll play around a bit and see if I can figure something out.

from aurora.js.

asherawelan avatar asherawelan commented on July 21, 2024

You legend! I'm happy to tip you for your time...cheers!

Sent from my iPhone

On 28 Oct 2013, at 04:50, Devon Govett [email protected] wrote:

I looked at that code you linked to in mp3.js above where you are seeing the error, and have a possible explanation. That code is looking for the next frame after the current one, which is apparently not loaded yet. Or perhaps because the next frame hasn't been encoded yet since it is streaming, looking for the next frame there is wrong. I'll play around a bit and see if I can figure something out.


Reply to this email directly or view it on GitHub.

from aurora.js.

asherawelan avatar asherawelan commented on July 21, 2024

Any further news on this? Happy to tip the person who can fix it... cheers!

from aurora.js.

rodhoward avatar rodhoward commented on July 21, 2024

I would love to know if there is any progress! Streaming live feeds seems like THE reason to use these javascript codecs rather than simply using the browser html5 audio tags. Its the perfect used case except that it isn't working.

from aurora.js.

asherawelan avatar asherawelan commented on July 21, 2024

I never got it working for live streaming, such a shame...

from aurora.js.

asherawelan avatar asherawelan commented on July 21, 2024

Bump

from aurora.js.

asherawelan avatar asherawelan commented on July 21, 2024

Any further progress on this @devongovett - really keen to get this working... Cheers

from aurora.js.

pafnat avatar pafnat commented on July 21, 2024

i'm also interested. is at any solutions?

from aurora.js.

fabslab avatar fabslab commented on July 21, 2024

I think this is related to what's discussed here audiocogs/mp3.js#12

from aurora.js.

CoMMyz avatar CoMMyz commented on July 21, 2024

Anyone found a solution to this?

Thanks

from aurora.js.

driesken avatar driesken commented on July 21, 2024

I was wondering the same thing. Anyone found a working solution?

I'am able to receive audio packets at browser level, but I don't have any sound.

from aurora.js.

DeusExLibris avatar DeusExLibris commented on July 21, 2024

See this thread

from aurora.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.