Code Monkey home page Code Monkey logo

Comments (19)

bkw avatar bkw commented on June 7, 2024 1

that is pretty easy, but I would not suggest taking the detour with the pngs.
Basically want you want is the TcpVideoStream piped through PaVEParser then into a writeStream.
This way you record perfectly clean h264 frames straight to disk.

You can later add an mp4 container to these files like this:

ffmpeg -i recordedstream.h264 -vcodec copy out.mp4

l-smash is also very good for adding a container to h264:

muxer -i recordedstream.h264 --optimize-pd --file-format mp4 -o out.mp4

from node-ar-drone.

bkw avatar bkw commented on June 7, 2024

If you want the video to be streaming to a browser, take a look at ar-drone-png-stream or node-dronestream for realtime video.

from node-ar-drone.

yocontra avatar yocontra commented on June 7, 2024

I have a stream set up via canvas and the PNGStream already - just trying to get the record feature right. Is PaVEParser exposed or should I just clone the code into my local?

from node-ar-drone.

bkw avatar bkw commented on June 7, 2024

I don't think it's exposed. I thought, I had a pull request for that...

The PngStream doesn't use the PaVEDecoder, it just pipes everything to ffmpeg, hoping it will sort it out - which works most of the time.
If you want a real clean solution, I'd rather take the PaVEDecoder from node-dronestream, pipe in the tcpstream, and then hook both a recorder and a pngencoder to it. The pngencoder should also benefit from the filtered stream than PaVE delivers.

from node-ar-drone.

yocontra avatar yocontra commented on June 7, 2024

I'm getting a black video after running it through ffmpeg - the duration looks correct though. Here is my code so far (using your PaVEDecoder)

video = drone.createPngStream()
out = fs.createWriteStream './vid.h246'
parser = new PaVEParser

video._tcpVideoStream.pipe parser.pipe out

from node-ar-drone.

yocontra avatar yocontra commented on June 7, 2024

Using code similar to whats in dronestream ffmpeg returns vid.h246: Invalid data found when processing input

out = require('fs').createWriteStream './vid.h246'
parser = new PaVEParser
parser.pipe out

tcpVideoStream = new arDrone.Client.PngStream.TcpVideoStream timeout: 4000
tcpVideoStream.on 'error', console.log
tcpVideoStream.connect ->
  tcpVideoStream.pipe parser

from node-ar-drone.

bkw avatar bkw commented on June 7, 2024

strange. Have you looked at the recorded file? It should start with 00 00 00 01.
Do you the newest version of buffy? I think node-ar-drone still comes with an older one that doesn't have skip().
Sorry, only guessing...

from node-ar-drone.

bkw avatar bkw commented on June 7, 2024

you should be able to check the recorded stream with ffplay (comes with ffmpeg) also, it can play raw h264.

from node-ar-drone.

yocontra avatar yocontra commented on June 7, 2024

The h246 file starts with 6742 801e 8b68 0a02

Everything is at the latest - will try ffplay

from node-ar-drone.

bkw avatar bkw commented on June 7, 2024

reproduced. Very strange, I swear this worked. Let me check for a second.

from node-ar-drone.

bkw avatar bkw commented on June 7, 2024

Ahhh, sorry! I sent you on a wrong track! I optimized out the NAL-Headers for my Version of PaVE-Parser!
Sorry for wasting your time!

from node-ar-drone.

bkw avatar bkw commented on June 7, 2024

But it just confirmed it works with the PaVE-Parser from node-ar-drone.

from node-ar-drone.

bkw avatar bkw commented on June 7, 2024

I (earlier) recorded a video stream like this:

% nc 192.168.1.1 5555 > recorded.pave

and here is a pave to h264 converter:

var fs = require('fs');                                                         
var PaVEParser = require('./lib/video/PaVEParser');                             

fs.createReadStream('recorded.pave')                                                
    .pipe(new PaVEParser())                                                     
    .pipe(fs.createWriteStream('out.h264'));                                    

out.h264 is both usable by ffplayer and ffmpeg.

from node-ar-drone.

yocontra avatar yocontra commented on June 7, 2024

If I pipe the TCP stream -> PaVE -> file I get a file full of [object Object][object Object][object Object]

Changing this.emit('data', this._frame); to this.emit('data', this._frame.payload); fixes the issue - I think the client should expose a getRawVideoStream function that does this process

from node-ar-drone.

bkw avatar bkw commented on June 7, 2024

Glad it worked out in the end.
Apologies for the misleading information, I was confusing my many versions of the PaVEParser.

Since PeVEParser is not exposed and not used by any other project that I know of, I propose just changing it to emit a frame event with the frame data, and regular data events with the h264 payload for streaming.

I think this version does this.
I'm sick right now and find it hard to concentrate, I'll try to get it right later.

from node-ar-drone.

yocontra avatar yocontra commented on June 7, 2024

Changed the title to add exposing raw video stream. I think moving the tcp video stream up to the client and piping it to the pngstream/paveparser/whatever would be more accessible than having it within the pngstream

from node-ar-drone.

felixge avatar felixge commented on June 7, 2024

Changed the title to add exposing raw video stream. I think moving the tcp video stream up to the client and piping it to the pngstream/paveparser/whatever would be more accessible than having it within the pngstream

So you're suggesting to add drone.createTcpStream()? I'm 100% for this / looking forward to a patch : )

from node-ar-drone.

edup avatar edup commented on June 7, 2024

Hi Everyone,

I'm trying to built in an application that transforms the several canvas objects dynamically and constantly created into an h264 video stream.

I'm working with node.js now (but i can change).

Can you please suggest me the best way to to this?

Thanks in advance.

Eduardo

from node-ar-drone.

eschnou avatar eschnou commented on June 7, 2024

Following the latest refactoring of client.getVideoStream, and the added example, I propose to close this thread. Re-open if not happy with it :-)

from node-ar-drone.

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.