yuv

ffmpeg av_interleaved_write_frame(): Broken pipe under windows

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using ffmpeg to convert original media file to rawvideo yuv format, ouputed the yuv to pipe, then my command tool receive the raw yuv as input, do some processing. e.g: D:\huang_xuezhong\build_win32_VDNAGen>ffmpeg -i test.mkv -c:v rawvideo -s 320x240 -f rawvideo - | my_tool -o output every time, when run the command, ffmpeg will dump this av_interleaved_write_frame(): Broken pipe error msg: Output #0, rawvideo, to 'pipe:': Metadata: encoder : Lavf56.4.101 Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 120:91 DAR

Rotate an YUV byte array on Android

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm looking to rotate a YUV frame preview recieved from a Preview Callblack, so far I've founded this post which cointains an algorithm to rotate the frame preview but is messing the preview image camera pixels rotated another way to rotate the image will be creating a jpg out of the YUV image, create a bitmap, rotate a bitmap and obtaining the byte array of the bitmap, but I really need the format in YUV (NV21). FYI. the reason I'm asking this is because I have a camera app that supports rotation, but the frame previews are coming back in

opencv C++ create Mat object from android NV21 image data buffer

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have implemented an android application that starts the camera and send all the preview buffer down to native components using JNI interface. Since the preview data is in NV21 image format, I need to create a cv::Mat instance from it. I searched for it and found the below solution: cv::Mat _yuv(height, width, CV_8UC1, (uchar *) imagebuffer); where imagebuffer is jbyte* However, don't get the expected image in the output image. It's all filled with some random lines etc. Does anyone know how exactly I can do it? 回答1: You need to convert YUV

rgb to yuv420 algorithm efficiency

旧城冷巷雨未停 提交于 2019-12-03 02:04:40
问题 I wrote an algorithm to convert a RGB image to a YUV420. I spend a long time trying to make it faster but I haven't find any other way to boost its efficiency, so now I turn to you so you can tell me if this is as good as I get, or if there's another more efficient way to do it (the algorithm is in C++ but C and assembler are also options) namespace { // lookup tables int lookup_m_94[] = { 0, -94, -188, -282, -376, -470, -564, -658, -752, -846, -940, -1034, -1128, -1222, -1316, -1410, -1504,

Convert bitmap array to YUV (YCbCr NV21)

匿名 (未验证) 提交于 2019-12-03 02:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to convert Bitmap returned by BitmapFactory.decodeFile() to YUV format (simillar to what camera's onPreviewFrame() returns in byte array)? 回答1: Here is some code that actually works: // untested function byte [] getNV21(int inputWidth, int inputHeight, Bitmap scaled) { int [] argb = new int[inputWidth * inputHeight]; scaled.getPixels(argb, 0, inputWidth, 0, 0, inputWidth, inputHeight); byte [] yuv = new byte[inputWidth*inputHeight*3/2]; encodeYUV420SP(yuv, argb, inputWidth, inputHeight); scaled.recycle(); return yuv; } void

How to dump YUV from OMXCodec decoding output

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'd like to dump YUV data from OMXCodec decoding output. It's MediaBuffer type. It's impossible to access data() pointer. If I try to access data, crash happens due to the check code below. frameworks / av / media / libstagefright / MediaBuffer . cpp : 119 CHECK ( mGraphicBuffer == NULL ) failed . Please let me know the solution to extract YUV data from this MediaBuffer . 回答1: From the MediaBuffer , I feel that the following should be functional. I haven't tried the same yet and have worked with rg2's solution i.e. directly based

How to read a frame from YUV file in OpenCV?

匿名 (未验证) 提交于 2019-12-03 01:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to read a frame from YUV file in OpenCV? 回答1: As mentioned, there are MANY types of YUV formats: http://www.fourcc.org/yuv.php To convert to RGB from a YUV format in OpenCV is very simple: Create a one-dimensional OpenCV Mat of the appropriate size for that frame data Create an empty Mat for the RGB data with the desired dimension AND with 3 channels Finally use cvtColor to convert between the two Mats, using the correct conversion flag enum Here is an example for a YUV buffer in YV12 format: Mat mYUV(height + height/2, width, CV_8UC1,

Decoding a YUV image in Python OpenCV

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a YUV420_SP_NV21 image represented as a byte array (no headers), taken from an Android preview frame, and I need to decode it into a RGB image. I've done this in Android apps before, using Java and OpenCV4Android: convert_mYuv = new Mat(height + height / 2, width, CvType.CV_8UC1); convert_mYuv.put( 0, 0, data ); Imgproc.cvtColor( convert_mYuv, convert_mRgba, type, channels ); I've tried doing the same in Python: nmp = np.array(byteArray, dtype=np.ubyte) RGBMatrix = cv2.cvtColor(nmp, cv2.COLOR_YUV420P2RGB) , but RGBMatrix remains None

How to correctly use ImageReader with YUV_420_888 and MediaCodec to encode video to h264 format?

匿名 (未验证) 提交于 2019-12-03 01:11:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm implementing a camera application on Android devices. Currently, I use Camera2 API and ImageReader to get image data in YUV_420_888 format, but I don't know how to exactly write these data to MediaCodec. Here are my questions: What is YUV_420_888 ? The format YUV_420_888 is ambiguous because it can be any format which belongs to the YUV420 family, such as YUV420P , YUV420PP , YUV420SP and YUV420PSP , right? By accessing the image's three planes(#0, #1, #2), I can get the Y(#0), U(#1), V(#2) values of this image. But the

Difference between YUV420 and YUV422

我与影子孤独终老i 提交于 2019-12-03 00:41:47
Can you please help me understand what are the differences between YUV420 and YUV422 format? I read this, http://www.fourcc.org/yuv.php , but I can't find the difference. And does "YUV420" and "YUV420 SP" mean the same thing? And does "YUV422" and "YUV422 I" mean the samet thing? Thank you. 4:2:2 : The two chroma components are sampled at half the sample rate of luma: the horizontal chroma resolution is halved. 4:2:0 : The two chroma components are sampled at half the sample rate of luma both horizontally and vertically (i.e. there's one U and one V per 2x2 group of Y s). For info regarding