How can i get an image from a pcap file? - c#

I wrote a basic c# wrapper for winpcap to capture packets from an interface and saving them to a dump file. Now i wanna get images in that pcap files. Is there a c# library for this purpose?

Have a look at DriftNet
Inspired by EtherPEG (though, not owning an Apple Macintosh, I've never actually seen it in operation), Driftnet is a program which listens to network traffic and picks out images from TCP streams it observes. Fun to run on a host which sees lots of web traffic.

Related

How could I stream a video torrent on windows universal?

I'm currently developing a popcorn-time like app for Windows 8.1/WP8.1, and I would like to know how I could possibly stream a torrent file? How complex would it be to get a video stream, starting with what I have available in this API: https://yts.to/api/ (aka, a magnet link and a list of trackers)?
Technically speaking, Popcorn Time is a bittorrent client (like utorrent) with video player support.
You will have to implement the bittorrent protocol or get an existent lib (monotorrent, ...) to work.
You will need to:
Read torrent file (or magnet)
Connect with trackers
Get a list of peers
Connect with peers
Download and upload pieces
To stream, I believe it basically means that the torrent should be downloaded sequentially.
Be careful with legal stuff.

Grab Audio Sessions as they appear in the windows audio mixer (C# or C++)

I'm trying to figure out how to grab the individual audio streams as they appear in the audio mixer to reroute them to an aggregate audio device. I'm specifically looking to keep them as discreet streams for the purposes of the program I'm making (If they're muxed down to a 2-channel mix, that defeats the purposes of what I'm trying to achieve.)
E.X.: (As I've just made this account, I apparently am not able to post images, so here's a link to the image)
windows audio mixer
In this, I'm hoping to grab "System Sounds" and "Stream Client Bootstrapper" as discreet audio streams to route elsewhere, while maintaining their original destination as well (essentially copying the audio going to the original audio device to another simultaneously).
I'm looking to do this in either C# or C++. I've perused the audio APIs that microsoft has published, and while some things look to be close to what I'm trying to do, nothing has hit the nail on the head. I appreciate any help. Thanks.
The sessions can be enumerated using IAudioSessionManager2::GetSessionEnumerator and friends (sample C++ code is here and there). Standard Windows volume mixer application is using this API as well.
The API however has no access to data streams, you won't have either (you certainly don't have data whether they are downmixed or not). Neither you can reroute streams to another device. Applications are not allowed to interfere that deep. The best you can do is to create your own device, interactively select it as default output device and then accept data from applications playing audio through this device.

Video Capturing + Uploading + Processing + Streaming back - .NET & C#

We are trying to find out any technologies/libraries available in .NET stack (even wrappers on top of 3rd party dlls) that'll help us to build an app that can
1 - Capture an image from a user's video device
2 - Upload it realtime to a server
3 - Process the video (in the server) - eg: Adding a watermark to the video
4 - Stream it back to the user/other users
Preferably, the time delay/latency between step2 and 4 should be minimal
The first requirement (capturing) seems pretty straight forward. The challenge is identifying a suitable way to do the upload, do the processing, and stream it back. Any valid suggestions or ideas?
Recently came acrsoss FFmpeg library, and it has a C# wrapper. Does FFmpeg can be used to do the processing side?
I would go about it this way:
Use silverlight or flash to capture the video camera input, e.g. as detailed here.
You can send the byte-stream over a socket that your server is listening to.
On the receiving end, just use the socket-accepting program as a router-program with a number of listening workers connected. Between workers and router-program, e.g. AMQP with RabbitMQ. Send asynchronous messages (e.g. with reactive extensions) with e.g. the stream encoding to the rabbit-node, which then can either further all messages to one single computer as a part of a conversation/user-session, or interleave between the available workers. Here's the manual. As the video is encoded, it is streamed asynchronously over the message bus back. According to intel tests the bus itself should work well at high throughputs, but they had to use the interleaved tcp channel mode (they tested on a gigabit lan). Other users here have suggested FFlib. You might also look into having the workers convert into webM, but if FFlib works, that might be a lot easier. Each worker publishes over AMQP the next encoded video piece. A server-running program, e.g. the router program I talked about before, starts sending to the client (see no. 4)
Have a client-program, e.g. silverlight/flash connect (for example over the same socket that you opened for client->server data, or over HTTP), and read the byte-stream with a decoder. Render the output.
VideoLab from Mitov can accomplish all of this and is free for personal use (not so free for commercial use, but pricing is not too heavy).
I have bought and use the Delphi version and know it works extremely well, so I'm pretty sure the .NET version will do what you need.
This kind of task is not trivial (as seen by the lack of responses here), so expect to struggle considerably with DirectX/Microsoft Media Encoder- but with this toolkit and some help from the author, you will eventually succeed.
http://www.mitov.com/html/videolab.html
It seems that Splicer can process static video and convert it - I'm not sure about processing a realtime uploaded video - http://splicer.codeplex.com/
Take a look at Video.Show by Vertigo. It's an open source website for user-generated video content. It uses the Expression Encoder to handle compression/video editing. It's not exactly what you need, but it's a good start!
You could use Silverlight for capture as is mentioned above, and then use Expression Encoder to push it to a stream server or stream from there directly.
It should have everything you need:
Smart encoding/smart recompression for
WMV if the source is also WMV and no
frame operations are performed [4],
cuts editing, serial batch encoding,
Live encoding from webcams and DV
camcorders
Decoding/import format support because
of DirectShow
Smooth streaming (720p+ video using
HTTP) with optimized client
(Silverlight) and server (IIS with
smooth streaming)
WebDAV publishing, publishing plugins
for Silverlight Streaming, Amazon S3
Importing XAML overlays created in
Expression Design and customizing
their timing, animation, opacity,
placement and looping
JavaScript trigger events
Windows Media 11 SDK and VC-1 SDK
integration, native MPEG-2 decoder
Adding captions to videos using SAMI
or W3C Timed Text format
Previewing and comparing encoding
settings in real time
Screen capture
Object model for the encoding engine,
SDK downloadable separately
The question is kind of short on details (is this a web server, what os is the server? etc) but I'll take a stab based on what I think you're trying to do.
One thing you might consider is doing the capture and process at one time. If the user is running your client app, have that do the capture and processing via DirectShow. Then all you need to do is upload the video and you can skip the entire server process. This is assuming that the 'user' is under your control - that this is not some random person out there uploading video, but an employee or someone otherwise trusted.
If this isnt the case, then ffmpeg can certainly be used to watermark video on your server. You dont really need 'wrappers' for it. You can just call it as a command line app from your server application and wait for it to finish.
The process really isnt that complex... its the details that are going to matter (for example - what does 'stream' mean to you? Do you really mean 'stream', or is this via http? Thats a huge topic right there)

Are there any open source video transcoding servers?

Are there any servers written that can be setup to take video transcode jobs? I am looking to set one up to work just like the service Zencoder. Something that I could send my transcoding jobs to maybe via web-services. If not are there any c# wrappers to the common open source transcoders such that I could write one.
Check out http://www.kaltura.com, they have an open source server that might suit your needs.
You could put FFmpeg on an EC2 instance. Or just use Zencoder and save yourself some time and pain.

Listen on printer cable for print and save to image file?

I assume I would need a special centronics cable to do this, but is it possible to get the print data from the remote device and convert it to a image file in .Net?
thanks,
Jason
This has not much to do with .NET. First you need to have some "receiver" hardware and driver, then you need to know the protocol used (PCL, PostScript, or something completely different or proprietary), and only then you can start thinking about the platform where you process the data.
That said, it may be easier to capture the data directly on the remote device.
Doing a remote capture of an LPT connection would be rather difficult. Converting the print data into an image would probably be even more difficult. (PCL, Postscript, or one of many other formats.)
If you just need the ability to print to an image why not check out something like PDFCreator. I have used it on several occasions and it works great. You can even share the virtual printer out as a network share or LPR queue for remote printing. You can configure it to print to a standard share on a network. And later you could write a service that could move the images to FTP or send them over email. (Much less pain then trying to sniff LPT.)
More...
It may be possible to use something like a parallel LapLink cable between the computer that is currently attached to the printer and another computer. Using a setup like that you could try to sniff the data connection. The problem is some of the functions for printing will not work with a bi-directional data cable so it it possible you would have one heck of a trying to protocol sniff the printer data.
Parallel Port (PC)
LapLink Cable
Printer Cable
IEEE 1284-B
IEEE 1284-C
Centronics (36 pin)
If it's possible to get the device you want to capture from to print to a serial port it will be vastly easier to get the data stream into the PC. I've listed a couple of commercial solutions below and they all convert to serial to go to the PC. To get the data from the parallel port you've got to handle the hardware interface See LPTCAP, then you've got to read from the parallel port. See Parallel Port Central, look for the Programming heading about half way down.
Some commercial solutions are PrintCapture and Photologic.

Categories