Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpout simple server question #2772

Open
rbouqueau opened this issue Mar 6, 2024 · 7 comments
Open

httpout simple server question #2772

rbouqueau opened this issue Mar 6, 2024 · 7 comments

Comments

@rbouqueau
Copy link
Member

I'm trying to use this httpout feature to create a small origin.

I thought that eventually we could extend it to add some dashin forward. However I'm failing with the most basic use-case:

> gpac httpout:rdirs=outcoming:wdir=incoming:port=8080 #server
> gpac avgen c=aac c=avc -o http://:8080/live.mpd:hmode=push:rdirs=/tmp/tmp/dash #source
> gpac -play http://127.0.0.1:8080/live.mpd #or curl etc. for playback

The issue is that the source can't push to the server:

[HTTPOut] Failed to open output file /audio_dash_track1_init.mp4: IP Connection Failed

What's the status of this feature? Do we maintain it? For which use-case?

@aureliendavid
Copy link
Member

is it better by specifying the full url http://127.0.0.1:8080/live.mpd in the second command?

there's some tests about it here https://github.com/gpac/testsuite/blob/master/scripts/out_http.sh that might help

@rbouqueau
Copy link
Member Author

Thank you. Almost there:

> rm -rf outcoming/* incoming/* && gpac httpout:rdirs=outcoming:wdir=incoming:port=8080
> gpac avgen reframer:rt=on c=aac c=avc -r -o http://127.0.0.1:8080/live.mpd:hmode=push:rdirs=/tmp/tmp/dash:dmode=dynamic:segdur=2
> gpac -play http://127.0.0.1:8080/live.mpd #or curl etc. for playback

I can know get the manifest.

However the source seems to run slower than it should for video:

audio (mp4mx): mux segments 7 (frags 1) next 8.000 TK1(A): 26
video (mp4mx): mux segments 3 (frags 0) next 4.000 TK2(V): 0

The problem doesn't arise if I remove :hmode=push.

@jeanlf
Copy link
Member

jeanlf commented Mar 26, 2024

Are you using HTTP2 here ? Can you reproduce when disabling it (-no-h2) ?

@rbouqueau
Copy link
Member Author

It makes no difference.

@jeanlf
Copy link
Member

jeanlf commented Mar 26, 2024

can you try with another http server, like:

const http = require('http')
const fs = require('fs');


const server = http.createServer(function(request, response) {
  if ((request.method == 'POST') || (request.method == 'PUT')) {
    var body_len = 0;
    var fio = fs.createWriteStream("rec"+request.url);

    request.on('data', function(data) {
      body_len += data.length;
      fio.write(data);
    })
    request.on('end', function() {
      console.log(request.url + ' got bytes ' + body_len);
      fio.end();
      response.writeHead(200, {'Content-Type': 'text/html'})
      response.end('post received')
    })
  } else {
    console.log('test is ' + request.method)
    var html = `
            <html>
                <body>
                    <form method="post" action="http://localhost:3000">Name: 
                        <input type="text" name="name" />
                        <input type="submit" value="Submit" />
                    </form>
                </body>
            </html>`
    response.writeHead(200, {'Content-Type': 'text/html'})
    response.end(html)
  }
})

const port = 8080
const host = '127.0.0.1'
server.listen(port, host)
console.log(`Listening at http://${host}:${port}`)

@rbouqueau
Copy link
Member Author

Yes it works with other HTTP servers (I could not make it work with yours -see below- but with another). I do think there is an issue with GPAC's httpout simple server.


rbouqueau@rose:~/works/Dolby/gpac_filters_sample_app$ vim server.js
rbouqueau@rose:~/works/Dolby/gpac_filters_sample_app$ node server.js
Listening at http://127.0.0.1:8080
/live.mpd got bytes 1549
/audio_dash_track1_init.mp4 got bytes 895
node:events:495
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open 'rec/live.mpd'
Emitted 'error' event on WriteStream instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'rec/live.mpd'
}

Node.js v18.19.0

@rbouqueau
Copy link
Member Author

I've just tested and what is weird is that the dasher seems ok (dasher: PDID1 AS#1.1(A) done (72 segs) AS#2.1(V) seg #71 0.36s (36.00 %) / MPD 70.28s 68 %) while the mp4mx is not:

[15:17:52.607Z] GPAC Session Status: mem    1413615 kb CPU  9
avgen (jsf): 2 output PIDs       4911 pck - EOS
reframer: 2 input PIDs       4911 pck 2 output PIDs       4911 pck - EOS
ffenc:aac (ffenc): Audio (MPEG-4 AAC Audio)       3098 pck 5924.20 FPS - EOS
ffenc:libx264 (ffenc): [FFEnc] FPS 766.39 F 1759 DTS 1758 CTS 1758 Q 28.00 PT B (F_in 1810)
manifest_mpd (httpout): File 3 input PIDs       4150 pck - EOS
dasher: PDID1 AS#1.1(A) done (72 segs) AS#2.1(V) seg #71 0.36s (36.00 %) / MPD 70.28s 68 %
video (rfnalu): AVC|H264 1280x720       1902 NALU       71 I      557 P     1131 B        1 SEI
audio (resample): Audio (Raw media)       3099 pck 15343.71 FPS 
audio (mp4mx): mux segments 71 (frags 1) next 72.000 TK1(A): 39
video (mp4mx): mux segments 33 (frags 0) next 34.000 TK2(V): 0
Active filters: 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants