video-processing

How to convert a kCVPixelFormatType_420YpCbCr8BiPlanarFullRange buffer to UIImage in iOS

余生颓废 提交于 2019-11-28 07:02:36
I tried to answer this in the original thread however SO would not let me. Hopefully someone with more authority can merge this into the original question. OK here is a more complete answer. First, setup the capture: // Create capture session self.captureSession = [[AVCaptureSession alloc] init]; [self.captureSession setSessionPreset:AVCaptureSessionPresetPhoto]; // Setup capture input self.inputDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; AVCaptureDeviceInput *captureInput = [AVCaptureDeviceInput deviceInputWithDevice:self.inputDevice error:nil]; [self

splitting video into images in matlab

血红的双手。 提交于 2019-11-28 06:39:12
问题 I am on a problem. My problem is that I want to split all image frames from an avi video. First of all I used aviread() function it gives me the out of memory error. Then from online help I were using mmreader() and read() function to split image frames, but the problem is read images from read() function could not be showed with imshow() function. I have the following code snippet, function test() A='G:\ims\avi\nh.avi'; B=mmreader(A); ims=read(B,[2000 2200]); figure(1),imshow(ims(1)); end I

How to Add Font size in subtitles in ffmpeg video filter

岁酱吖の 提交于 2019-11-28 05:08:13
I'm using this command to crop,scale, and then add subtitles as overlay ffmpeg -i input.avi -vf "[in]crop=in_w:in_h-20:0:0 [crop]; [crop]scale=320:240 [scale];[scale]subtitles=srt.srt" -aspect 16:9 -vcodec libx264 -crf 23 oq.mp4 how can we set font size/color of subtitle ? There are two methods to use subtitles: hardsubs and softsubs. Hardsubs The subtitles video filter can be used to hardsub, or burn-in, the subtitles. This requires re-encoding and the subtitles become part of the video itself. force_style option To customize the subtitles you can use the force_style option in the subtitles

Can ffmpeg burn in time code?

☆樱花仙子☆ 提交于 2019-11-28 04:34:57
I have a need to burn in a time code to a video and am wondering if this is something that ffmpeg is capable of? Short answer, no. Long answer, yes, but not without using a separate library to create the frames with the rendered time code on them, with transparency filling the rest of the frame, then using FFmpeg to overlay the frames on the existing video. Off the top of my head I don't know how to do this, but I'm sure if you're creative you can figure it out. Edit: I've been working on this problem because it is an interesting question/project for me. I have come a little further in the

ffmpeg video to opengl texture

雨燕双飞 提交于 2019-11-28 03:15:47
I'm trying to render frames grabbed and converted from a video using ffmpeg to an OpenGL texture to be put on a quad. I've pretty much exhausted google and not found an answer, well I've found answers but none of them seem to have worked. Basically, I am using avcodec_decode_video2() to decode the frame and then sws_scale() to convert the frame to RGB and then glTexSubImage2D() to create an openGL texture from it but can't seem to get anything to work. I've made sure the "destination" AVFrame has power of 2 dimensions in the SWS Context setup. Here is my code: SwsContext *img_convert_ctx = sws

Android: Alternative to the deprecated Context.MODE_WORLD_READABLE?

前提是你 提交于 2019-11-28 01:49:32
From here I know a way to write a file and be accessible to other app and other intent, but now that the Context.MODE_WORLD_READABLE is deprecated how can I safely accomplish this? FileOutputStream out = myActivity.openFileOutput(fileTo, Context.MODE_WORLD_READABLE); Okay more info: I'm using this: intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(uri, "video/*"); And the uri will be the one that I will write to a sdcard location. And the video will come from the application so problem is, if this is now not allowed, how can I write the file and view it. And the uri will be the

OpenCV: Reading image series from a folder

空扰寡人 提交于 2019-11-28 01:21:36
问题 I am trying to read a series of images from a folder using OpenCV's VideoCapture function. After some search on the internet, my current code is like this: cv::VideoCapture cap ( "C:\\Users\\Admin\\Documents\\Images\\%02d.jpg"); I was expecting to see that VideoCapture function should read all the images in that folder with names of two serial digits, like 01.jpg, 02.jpg, ..., 30.jpg . Someone told on the internet that the VideoCapture function should be ale to catch all of these images once

How to trim the video file and convert to 20 seconds video with Swift?

会有一股神秘感。 提交于 2019-11-28 01:10:42
问题 I want to trim a video file. I want to just pick the video from gallery and convert it to a 15 second video. I am following this link for Objective C. It works fine for me but I'm a beginner with the Swift language. Can any one help me to convert this code in Swift? Below is my code in Objective C: -(void)cropVideo:(NSURL*)videoToTrimURL{ AVURLAsset *asset = [AVURLAsset URLAssetWithURL:videoToTrimURL options:nil]; AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]

How to read a frame from YUV file in OpenCV?

一世执手 提交于 2019-11-27 23:53:34
How to read a frame from YUV file in OpenCV? I wrote a very simple python code to read YUV NV21 stream from binary file. import cv2 import numpy as np class VideoCaptureYUV: def __init__(self, filename, size): self.height, self.width = size self.frame_len = self.width * self.height * 3 / 2 self.f = open(filename, 'rb') self.shape = (int(self.height*1.5), self.width) def read_raw(self): try: raw = self.f.read(self.frame_len) yuv = np.frombuffer(raw, dtype=np.uint8) yuv = yuv.reshape(self.shape) except Exception as e: print str(e) return False, None return True, yuv def read(self): ret, yuv =

Is there a way to use ffmpeg to determine the encoding of a file before transcoding?

前提是你 提交于 2019-11-27 20:09:17
I am planning to use ffmpeg to ensure all video files uploaded to my website are encoded as mp4 h264. Rather than automatically processing every file I would like to minimise the processing overhead by only processing those files that are not already mp4 h264. Is there an easy way to do this either with ffmpeg or with another command line utility? If you pass an input file to ffmpeg, without other parameters, it will give you information about the video source: ffmpeg -i myfile.avi Another way would be the -identify option of mplayer, which might be slightly easier to parse. There is a wrapper