Swift – How to record video in MP4 format with UIImagePickerController?

I made some modifications to the following 2 answers to make it compatible with Swift 5: https://stackoverflow.com/a/40354948/2470084 https://stackoverflow.com/a/39329155/2470084 import AVFoundation func encodeVideo(videoURL: URL){ let avAsset = AVURLAsset(url: videoURL) let startDate = Date() let exportSession = AVAssetExportSession(asset: avAsset, presetName: AVAssetExportPresetPassthrough) let docDir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] let myDocPath = NSURL(fileURLWithPath: docDir).appendingPathComponent(“temp.mp4”)?.absoluteString let docDir2 = FileManager.default.urls(for: .documentDirectory, … Read more

Creating thumbnail from local video in swift

Translated with some edits from: First frame of a video using AVFoundation var err: NSError? = nil let asset = AVURLAsset(URL: NSURL(fileURLWithPath: “/that/long/path”), options: nil) let imgGenerator = AVAssetImageGenerator(asset: asset) let cgImage = imgGenerator.copyCGImageAtTime(CMTimeMake(0, 1), actualTime: nil, error: &err) // !! check the error before proceeding let uiImage = UIImage(CGImage: cgImage) let imageView = UIImageView(image: … Read more

How to record video from background of application : Android

1- I have created a activity to start service like this: package com.android.camerarecorder; import android.app.Activity; import android.content.Intent; import android.hardware.Camera; import android.os.Bundle; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.widget.Button; public class CameraRecorder extends Activity implements SurfaceHolder.Callback { private static final String TAG = “Recorder”; public static SurfaceView mSurfaceView; public static SurfaceHolder mSurfaceHolder; public static Camera … Read more

Sending message to background script

You cannot simply use messaging the same way you would use it in a content script from an arbitrary webpage’s code. There are two guides available in the documentation for communicating with webpages, which correspond to two approaches: (externally_connectable) (custom events with a content script) Suppose you want to allow http://example.com to send a message … Read more

Screen Capture with OpenCV and Python-2.7

That’s a solution code I’ve written using @Raoul tips. I used PIL ImageGrab module to grab the printscreen frames. import numpy as np from PIL import ImageGrab import cv2 while(True): printscreen_pil = ImageGrab.grab() printscreen_numpy = np.array(printscreen_pil.getdata(),dtype=”uint8″)\ .reshape((printscreen_pil.size[1],printscreen_pil.size[0],3)) cv2.imshow(‘window’,printscreen_numpy) if cv2.waitKey(25) & 0xFF == ord(‘q’): cv2.destroyAllWindows() break

Record a video of the screen using .NET technologies [closed]

There isn’t any need for a third-party DLL. This simple method captures the current screen image into a .NET Bitmap object. private Image CaptureScreen() { Rectangle screenSize = Screen.PrimaryScreen.Bounds; Bitmap target = new Bitmap(screenSize.Width, screenSize.Height); using(Graphics g = Graphics.FromImage(target)) { g.CopyFromScreen(0, 0, 0, 0, new Size(screenSize.Width, screenSize.Height)); } return target; } I am sure you … Read more