decode

Inconsistent sample time / presentation time during video decoding

我的梦境 提交于 2019-12-18 05:08:26
问题 I'm writing an APP that can encode video by camera input and process video by decode-edit-encode steps. For the camera, I use the Camera class rather than Intent to configure the details settings of the camera. Then I feed the camera frames to the encoder (MediaCodec in API 16) and the muxer (I use ffmpeg muxer since I want to work on 4.1 Devices). I measure the time code of camera frames by system nano time, and select a subset of frames to fit a desired FPS (currently 15). There are some

Decode base64 String Java 5

蹲街弑〆低调 提交于 2019-12-18 04:14:55
问题 Is there a straight forward way to decode a base64 string using ONLY THE JAVA 1.5 LIBRARIES? I have to use Java 1.5 due to cross platform compatibility issues between Windows and Mac OS X (only Mac 10.5 supports Java 1.6, everything lower than 10.5 has Java 1.5 as default). The object "sun.misc.Base64Decoder" exists in Java 6, but not in Java 5. 回答1: No, it's not possible based on just using JDK 5.0. You'll need to roll your own implementation (it isn't that hard) or preferably use one of the

Storing message into R,G,B instead of Alpha

依然范特西╮ 提交于 2019-12-17 20:32:54
问题 How to change it to store message into least significant bit of R,G,B. The code below only embed message into Alpha (0~7bit) embedInteger deals with embedding the length of the message in the first 32 pixels. embedByte embeds your message characters, one by one. Every time it is called upon, it takes as an input the next character in your message in byte form, b[i]. There, it embeds one bit per pixel, for a total of 8 bits per byte. private void embedMessage(BufferedImage img, byte[] mess) {

Decode this strange Javascript

北城余情 提交于 2019-12-17 19:46:25
问题 I came across this code in a .js file. What is this code ?? I have downloaded that file onto my localhost webserver.Keeping this code in the .js file redirects me to google.com and when i am commenting this code the page runs perfectly !! I can understand that this is done to enforce that the page is to be executed from a server link only !!! How can i decode this js ??? []['\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72']['\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72'](self['\x75\x6e\x65\x73

Compress Videos using android MediaCodec api

跟風遠走 提交于 2019-12-17 17:59:38
问题 I want to compress locally saved video file to a smaller size in order to upload to a server. Since i used MediaCodec , i have found some tips to compress video . Here are the steps that i followed 1) . Extracted the media file using MediaExrtactor and Decoded it. 2) . Creates the Encoder with required file format 3) . Create muxer to save file in local storage. (not complete) Question : But i dont know how to encode the already decoded stream and save the stream in to the local storage using

Write Base64-encoded image to file

╄→尐↘猪︶ㄣ 提交于 2019-12-17 17:48:07
问题 How to write a Base64-encoded image to file? I have encoded an image to a string using Base64. First, I read the file, then convert it to a byte array and then apply Base64 encoding to convert the image to a string. Now my problem is how to decode it. byte dearr[] = Base64.decodeBase64(crntImage); File outF = new File("c:/decode/abc.bmp"); BufferedImage img02 = ImageIO.write(img02, "bmp", outF); The variable crntImage contains the string representation of the image. 回答1: Assuming the image

Java NIO之tcp粘包拆包

一个人想着一个人 提交于 2019-12-17 01:42:18
一 ByteToMessageDecoder 1.1 实例 ByteToMessageDecoder,用于把一个byte流转换成一个对象,实例: public class StringDecoder extends ByteToMessageDecoder { protected void decode ( ChannelHandlerContext ctx , ByteBuf in , List < Object > out ) throws Exception { byte [ ] bytes = new byte [ in . readableBytes ( ) ] ; in . readBytes ( bytes ) ; out . add ( new String ( bytes ) ) ; } } 它有一个抽象方法decode,我们实现了这个方法,这个方法的第三个参数是一个List,所有加入这个List的对象都会被逐一的调用fireChannelRead方法映射事件。 使用方法:ByteToMessageDecoder其实就是一个ChannelInboundHandler,直接加入到Pipeline即可: serverBootstrap . childHandler ( new ChannelInitializer < SocketChannel > ( ) {

Decode Base64 encoded ZIP archive (GZIP)

六眼飞鱼酱① 提交于 2019-12-14 03:35:25
问题 I need to decode a Base64 encoded ZIP archive (GZIP) String in Java. String = "4sIAAAAAAAEAL1W32/aMBB+n7T/wco7NYPuJUoiIZg0JGi70q59Nc6NWEps5h8j/PdzY4eGNVQIuXuyfXf+fPdd/DnJrdElaJV9/oRQUqtY0QIqglieRt4VoboquUojP4lrOy+03sYY73a7q934SsgNHg2HX/DzcrFqANrYSuVEkzQykntoNagYlUKJX3pARRXbuIGLipokXBpQQgVcI04q6GTiAuO5mtlhBTqNtDRwsD8qmBop7caFoKQE7/a4DtmeuS2hfthv4WD3nkIwCqhi/JZSI22VQ4tM6nZl+FoYnkMedTaeTvc46r3DX/0Kfhvg9K2z75in7/NZhLTFSiPrZFxH/ySPz8MhEgphFNzYZQdQacn45jLMCdXsTxdsLUQJhF

decodeString codefights: Program doesn't pass all tests.“30/31 Output limit exceeded on test -31”. Kindly support

那年仲夏 提交于 2019-12-14 03:22:09
问题 function decodeString(s) { let arr = []; let digitSum = ''; let digitSumArr = []; // for numbers before '[' let i; //iterating string for (i = 0; i < s.length; i++) { if (!isNaN(s[i])) { digitSum += s[i]; // count number before '[' } else if (s[i] === '[') { // add number to the array digitSumArr.push(+digitSum); arr.push(i + 1); digitSum = ''; } else if (s[i] === ']') { let digit = digitSumArr.pop(); i = decStr(arr, i, digit); digitSum = ''; } else { digitSum = ''; } } return s; function

Getting/Setting a bit value from image

天涯浪子 提交于 2019-12-14 03:07:22
问题 Question is based on this site. Could someone explain the meaning of these lines: private int getBitValue(int n, int location) { int v = n & (int) Math.round(Math.pow(2, location)); return v==0?0:1; } and private int setBitValue(int n, int location, int bit) { int toggle = (int) Math.pow(2, location), bv = getBitValue(n, location); if(bv == bit) return n; if(bv == 0 && bit == 1) n |= toggle; else if(bv == 1 && bit == 0) n ^= toggle; return n; } 回答1: int v = n & (int) Math.round(Math.pow(2,