Screen recording and live streaming (Windows DXGI) - C++ - windows

I am using the Desktop Duplication API in Windows to obtain images of the screen. I know to obtain the bitmap image of the screen by using the API but I am stuck after this. To stream it to the server I thought of encoding it into H264 and then encoding that again to RTMP and then streaming it to the server. Is there a better and faster way?
I searched many times and most of the answers are using FFmpeg and just finishing the whole task of screen recording to streaming in a single line. Please tell me a way to do this programmatically!!
How do I encode to H264 and then to RTMP? If the video is being double encoded, will this result in a loss of performance in both streaming side and receiving side?
Please point me in the right direction. Any hints or links will be very helpful.

Related

Stream a website to a mp4 (rendering html to a mp4)

I am trying to composite a website (which contains JavaScript and as a result is updating regularly) with a video feed. My goal is to do it on virtual hosted Linux server (my plan is to use Ubuntu, but I am flexible) - I am not interested in solutions utilizing OBS or the like as my solution would be headless.
The problem I am facing is how to output the website to a video stream from a command line.
The site I want to capture is https://vscore.ch/home and I would like to render it in a way that I can feed it to ffmpeg where I can composite it with the live game video that is being delivered via RTMP.
You may want to use this puppeteer plugin and stream those screenshots, or parse them into a video and stream that.

Live Video Streaming in xamarin forms

I want to add Live Video streaming (IP Camera set up) in Xamarin Forms. I have found link click here but I don't know how to implement this in Xamarin forms or any other option for implement live video streaming in xamarin forms anyone, please help me.
Check out https://github.com/videolan/libvlcsharp.
It supports playing RTSP out of the box.
First of all, you likely want to convert the IP camera stream to something else. RTSP is going to be a pain to get working cross platform, and i don't know of any library that handles that nicely for Xamarin. RTSP is also hard to get working well across networks with Firewall, NAT etc.
You can convert the RTSP stream to HLS, and have a much easier time. Conversion to HLS has a number of solutions, from hacking something together with ffmpeg to a more streamlined solution like Wowza.
Once the stream is HLS, you should be able to get it working with something like Xamarin Media Manager without too much trouble.

ffmpeg streaming video website -- converting on the fly vs. hosting multiple formats

The setup: A website that streams uploaded videos using ffmpeg on the backend. Different video formats are served based on the needs of the client-device.
My understanding is that some websites keep the same video in multiple formats, while others convert the non-HTML5 video (say) into HTML5 video on the fly if the client-device calls for HTML5 video.
Why do one over the other?
Most websites/hosting platforms will keep the same video in multiple HTML5 video compatible formats (mp4 and webm as of today) for on demand delivery. Processing video on the fly requires CPU/GPU and that can cause penalty on the server load if too many people watch videos at the same time. Upstream transocding + storage/CDN is often less expensive and better for scalability.
Live video streaming is another story because you can get MPEG2 (or else) input and this often needs to be converted on the fly to multiple H264/AAC renditions either with ffmpeg or adds on like Wowza Media Server Transcoder.
EDIT:
why do sites still host Flash and non-Flash (i.e. HTML5) versions of videos?
Most do not and you do not need to. They use MP4 files to be delivered on both Flash and HTML5. You can find FLV or F4V (Adobe flavor of MP4) but they are either legacy, ads oriented, or flash only environment files (FLV can be used to store cue points for example to trigger animation at certain point of a video). Youtube for say mostly used MP4 files but you will find they deliver both flv and 3gp files (mobile) as well.
HTML5 is universal and can play on any client. Flash is restricted to PCs. By now they should have dumped Flash.
You can find on SO or Google articles describing the pros and cons of Flash vs. HTML5. Momentum on the market today is HTML5 first with a flash fallback.
HTML5 video is "only" available in 80% of current browsers. You would understand why major players like Youtube or Brightcove just won't let go of the remaining 20% audience.
Vimeo has made the switch for an HTML5 video first strategy.
Flash still holds some grounds HTML5 video has not yet covered (or is only beginning to):
DRM
Ads: you can understand now why Youtube and others have not made the HTML5 video first switch just yet.
Adaptive streaming (required for better user experience with video): though MPEG DASH is coming fast and HLS will work on Apple devices (and some others), browser adoption is still narrow for HTML5 video. Flash has well established RTMP and HDS support.
No need for cross browser tweaking: HTML5 video can be inconsistent across browser/version (events not firing as expected, prefix vendor required ...). Flash on the other hand only needs one type of video file format and will work as expected in any browser with the flash plugin installed.
Cost for technology switch: in the long run you will save money with HTML5 video (no license to pay for if you want to develop HTML5 video - web developers can do HTML5 video development and they can be less expensive than Flash expert). Short term moving to an HTML5 video first strategy is asking for major updates of a technology - hence cost.
Flash does not play on iOS and Android - that is a clear win for HTML5 video and a major drawback for Flash.
One growing caveat at the moment about flash is it being a plugin. That throws security and performance concerns. For example Microsoft has announced they will drop support for Silverlight in the coming years and is moving towards HTML5 video. Java (client side) is getting blocked more an more.
Not a good day to be a web plugin nowdays ...

Play a video online mode and cache it locally for playing in offline?

We have developed an application which is able to download an play the video in offline mode.But as the size of the video is much larger it is not possible for us to make the user wait for long to get video downloaded and play.So we would like to implement progressive download while playing the video but would also like to save the video locally for playing it locally too. Is there any way or any possibility of caching the video in offline mode ? Also can we implement any functionality where in a part of video played or buffered is saved locally and played in offline mode. Also can we make the buffering start or resume from the point where it was stopped when user is online ? Any Suggestions would be helpful.
Thanks.
I think you would need to download the video using FileTransfer.download() independently of playing it. Then you could cache the video on the filesystem and play it offline if the user wanted to watch it again.

Real-time audio record/playback from a Ruby web app

I am wondering if anyone has success with audio record (from microphone on the users browser) and playback from a web based app (Ruby/RoR)?
What I have found so far - I could write a flex/flash app which will record the audio and then have a server side like Red5 or so to receive and convert. This sounds more involved and I also saw different types of hosting issues etc people are having - so I am thinking there may be better/easier solutions out there!! I looked at html5/web-kit too but seems to only works on chrome and is limited to text fields etc.
In my app, i want to record users voice, save it on a aws/s3 as mp3 or similar file format and play it back to user within the app based on users input/choice. While flash based solution is workable for now, non-flash based solution will be preferred as it will support more devices (you know devices I am referring)..
The only options for web based record are Flash, Silverlight or Java. None of these will work on an iPhone or iPad - You will need a native app for that.
You don't need to use Red5 for Flash recording - you can record direct to memory, optionally encode (or zip), and then upload the the data. You might be better doing mp3 encoding server-side using ffmpeg or SoX before moving the file to s3.
There is a way using HTML5 and a server. Just record a video.
Convert the video to audio, then use the audio as you wish.
This implementation takes audio from a video and runs
ffmpeg to extract the audio:
http://goo.gl/A0bya
This is in PHP, but it should not be too
hard to create a Ruby version. Easy peasy.

Resources