Recherche avancée

Médias (0)

Mot : - Tags -/diogene

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (20)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 is the first MediaSPIP stable release.
    Its official release date is June 21, 2013 and is announced here.
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

Sur d’autres sites (6017)

  • Android bytedeco javacpp ffmpeg decode h264 bytes to yuv and render with openGL ES 2.0. Wrong colors

    9 juin 2015, par tema_man

    there ! I try to display a video stream, which comes from server as byte array.
    Data in this array is h264 encoded image and i decode it with bytedeco javacpp-presets library in this way :

    public class DMDecoder {

    private static final String LOG_TAG = "DMDecoder";

    private AVCodec avCodec;
    private AVCodecContext avCodecContext;
    private AVFrame avFrame;
    private AVPacket avPacket;
    private boolean wasIFrame;
    private long IFrameTimeStampMs;
    private int maxFps;
    private int codecId;

    private DMDecoderCallback callback;

    public DMDecoder(DMDecoderCallback cb) {
       this.callback = cb;
       this.codecId = AV_CODEC_ID_H264;
       avcodec_register_all();
       restart();
    }

    public void restart() {
       stop();
       start();
    }

    public void stop() {
       frames = 0;
       if (avCodecContext != null) {
           avcodec_close(avCodecContext);
           avcodec_free_context(avCodecContext);
           avCodecContext = null;
       }

       if (avCodec != null) {
           av_free(avCodec);
           avCodec = null;
       }

       if (avFrame != null) {
           av_frame_free(avFrame);
           avFrame = null;
       }

       if (avPacket != null) {
           av_free_packet(avPacket);
           avPacket = null;
       }
    }

    public void start() {
       avCodec = avcodec_find_decoder(codecId);

       avCodecContext = avcodec_alloc_context3(avCodec);
       AVDictionary opts = new AVDictionary();
       avcodec_open2(avCodecContext, avCodec, opts);

       avFrame = av_frame_alloc();
       avPacket = new AVPacket();
       av_init_packet(avPacket);
    }

    public VideoFrame decode(byte[] data, int dataOffset, int dataSize) {
       avPacket.pts(AV_NOPTS_VALUE);
       avPacket.dts(AV_NOPTS_VALUE);
       avPacket.data(new BytePointer(data).position(dataOffset));
       avPacket.size(dataSize);
       avPacket.pos(-1);

       IntBuffer gotPicture = IntBuffer.allocate(1);

       int processedBytes = avcodec_decode_video2(
               avCodecContext, avFrame, gotPicture, avPacket);

       if (avFrame.width() == 0 || avFrame.height() == 0) return null;

       VideoFrame frame = new VideoFrame();

      frame.colorPlane0 = new byte[avFrame.width() * avFrame.height()];
      frame.colorPlane1 = new byte[avFrame.width() / 2 * avFrame.height() / 2];
      frame.colorPlane2 = new byte[avFrame.width() / 2 * avFrame.height() / 2];

       if (avFrame.data(0) != null) avFrame.data(0).get(frame.colorPlane0);
       if (avFrame.data(1) != null) avFrame.data(1).get(frame.colorPlane1);
       if (avFrame.data(2) != null) avFrame.data(2).get(frame.colorPlane2);

       frame.lineSize0 = avFrame.width();
       frame.lineSize1 = avFrame.width() / 2;
       frame.lineSize2 = avFrame.width() / 2;

       frame.width = avFrame.width();
       frame.height = avFrame.height();

       return frame;
     }
    }

    VideoFrame class is just simple POJO :

    public class VideoFrame {
       public byte[] colorPlane0;
       public byte[] colorPlane1;
       public byte[] colorPlane2;
       public int lineSize0;
       public int lineSize1;
       public int lineSize2;
       public int width;
       public int height;
       public long presentationTime;
    }

    After decoding i send this frame to my GLRenderer class

    public class GLRenderer implements GLSurfaceView.Renderer {

       private static final String LOG_TAG = "GLRenderer";

       private TexturePlane plane;

       private ConcurrentLinkedQueue<videoframe> frames;
       private int maxFps = 30;
       private VideoFrame currentFrame;
       private long startTime, endTime;
       private int viewWidth, viewHeight;
       private boolean isFirstFrameProcessed;

       public GLRenderer(int viewWidth, int viewHeight) {
           frames = new ConcurrentLinkedQueue&lt;>();
           this.viewWidth = viewWidth;
           this.viewHeight = viewHeight;
       }

       // mMVPMatrix is an abbreviation for "Model View Projection Matrix"
       private final float[] mMVPMatrix = new float[16];
       private final float[] mProjectionMatrix = new float[16];
       private final float[] mViewMatrix = new float[16];

       @Override

       public void onSurfaceCreated(GL10 unused, EGLConfig config) {
           // Set the background frame color
           GLES20.glClearColor(0.1f, 0.1f, 0.1f, 1.0f);

           plane = new TexturePlane();
       }

       public void setMaxFps(int maxFps) {
           this.maxFps = maxFps;
       }

       @Override
       public void onDrawFrame(GL10 unused) {


           // Draw background color
           GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

           // Set the camera position (View matrix)
           Matrix.setLookAtM(mViewMatrix, 0, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);

           // Calculate the projection and view transformation
           Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mViewMatrix, 0);

           if (!isFirstFrameProcessed) checkViewPort(viewWidth, viewHeight);

           if (maxFps > 0 &amp;&amp; startTime > 0) {
               endTime = System.currentTimeMillis();
               long time = endTime - startTime;
               //
               long wantedTime = 1000 / maxFps;
               //
               long wait;
               if (time &lt; wantedTime) {
                   wait = wantedTime - time;
                   //
                   try {
                       Thread.sleep(wait);
                   } catch (InterruptedException e) {
                       Log.e(LOG_TAG, "thread interrupted exception");
                   }
               }
           }
           startTime = System.currentTimeMillis();
           tick();
           plane.draw(mMVPMatrix);
       }

       private void updateFrame(VideoFrame frame) {
           plane.updateTexture(frame.colorPlane0, frame.width, frame.height, 0);
           plane.updateTexture(frame.colorPlane1, frame.width / 2, frame.height / 2, 1);
           plane.updateTexture(frame.colorPlane2, frame.width / 2, frame.height / 2, 2);
           plane.setTextureWidth(frame.width);
           plane.setTextureHeight(frame.height);
       }

       private void tick() {

           if (frames.isEmpty()) return;

           VideoFrame frame = frames.peek();
           if (frame == null) return;

           long tms = System.currentTimeMillis();
           if (frame.presentationTime &lt;= tms) {
               updateFrame(frame);
               currentFrame = frame;
               frames.remove(frame);
           }
       }

       @Override
       public void onSurfaceChanged(GL10 unused, int width, int height) {
           checkViewPort(width, height);
           viewWidth = width;
           viewHeight = height;
           plane.setTextureWidth(width);
           plane.setTextureHeight(height);
       }

       private void checkViewPort(int width, int height) {
           float viewRatio = (float) width / height;
           if (currentFrame != null) {
               float targetRatio = (float) currentFrame.width / currentFrame.height;
               int x, y, newWidth, newHeight;
               if (targetRatio > viewRatio) {
                   newWidth = width;
                   newHeight = (int) (width / targetRatio);
                   x = 0;
                   y = (height - newHeight) / 2;
               } else {
                   newHeight = height;
                   newWidth = (int) (height * targetRatio);
                   y = 0;
                   x = (width - newWidth) / 2;
               }
               GLES20.glViewport(x, y, newWidth, newHeight);
           } else {
               GLES20.glViewport(0, 0, width, height);
           }

           Matrix.frustumM(mProjectionMatrix, 0, 1, -1, -1, 1, 3, 4);
       }

       public void addFrame(VideoFrame frame) {
           if (frame != null) {
               frames.add(frame);
           }
       }
    }
    </videoframe>

    GLRenderer works with simple openGL polygon, on which i draw all textures

       public class TexturePlane {

       private static final String LOG_TAG = "TexturePlane";

       private final String vertexShaderCode = "" +
       "uniform mat4 uMVPMatrix;" +
       "attribute vec4 vPosition;" +
       "attribute vec2 a_TexCoordinate;" +
       "varying vec2 v_TexCoordinate;" +

       "void main() {" +
       "  gl_Position = uMVPMatrix * vPosition;" +
       "  v_TexCoordinate = a_TexCoordinate;" +
       "}";

       private final String fragmentShaderCode = "" +
       "precision mediump float;" +
       "varying vec2 v_TexCoordinate;" +
       "uniform sampler2D s_texture_y;" +
       "uniform sampler2D s_texture_u;" +
       "uniform sampler2D s_texture_v;" +

       "void main() {" +
       "   float y = texture2D(s_texture_y, v_TexCoordinate).r;" +
       "   float u = texture2D(s_texture_u, v_TexCoordinate).r - 0.5;" +
       "   float v = texture2D(s_texture_v, v_TexCoordinate).r - 0.5;" +

       "   float r = y + 1.13983 * v;" +
       "   float g = y - 0.39465 * u - 0.58060 * v;" +
       "   float b = y + 2.03211 * u;" +

       "   gl_FragColor = vec4(r, g, b, 1.0);" +

       "}";

       private final FloatBuffer vertexBuffer;
       private final FloatBuffer textureBuffer;
       private final ShortBuffer drawListBuffer;
       private final int mProgram;
       private int mPositionHandle;
       private int mMVPMatrixHandle;

           // number of coordinates per vertex in this array
       private static final int COORDS_PER_VERTEX = 3;
       private static final int COORDS_PER_TEXTURE = 2;

       private static float squareCoords[] = {
           -1f, 1f, 0.0f,
           -1f, -1f, 0.0f,
           1f, -1f, 0.0f,
           1f, 1f, 0.0f
       };

       private static float uvs[] = {
           0.0f, 0.0f,
           0.0f, 1.0f,
           1.0f, 1.0f,
           1.0f, 0.0f
       };

       private final short drawOrder[] = {0, 1, 2, 0, 2, 3}; // order to draw vertices
       private final int vertexStride = COORDS_PER_VERTEX * 4; // 4 bytes per vertex

       private int textureWidth = 640;
       private int textureHeight = 480;

       private int yTextureUniformHandle;
       private int uTextureUniformHandle;
       private int vTextureUniformHandle;

       private int yTextureHandle;
       private int uTextureHandle;
       private int vTextureHandle;

       private int mTextureCoordinateHandle;

       public void setTextureWidth(int textureWidth) {
           this.textureWidth = textureWidth;
       }

       public int getTextureWidth() {
           return textureWidth;
       }

       public void setTextureHeight(int textureHeight) {
           this.textureHeight = textureHeight;
       }

       public int getTextureHeight() {
           return textureHeight;
       }

       /**
        * Sets up the drawing object data for use in an OpenGL ES context.
        */
       public TexturePlane() {
               // initialize vertex byte buffer for shape coordinates
           ByteBuffer bb = ByteBuffer.allocateDirect(squareCoords.length * 4);
           bb.order(ByteOrder.nativeOrder());
           vertexBuffer = bb.asFloatBuffer();
           vertexBuffer.put(squareCoords);
           vertexBuffer.position(0);

               // initialize byte buffer for the draw list
           ByteBuffer dlb = ByteBuffer.allocateDirect(drawOrder.length * 2);
           dlb.order(ByteOrder.nativeOrder());
           drawListBuffer = dlb.asShortBuffer();
           drawListBuffer.put(drawOrder);
           drawListBuffer.position(0);

               // initialize byte buffer for the draw list
           ByteBuffer tbb = ByteBuffer.allocateDirect(uvs.length * 4);
           tbb.order(ByteOrder.nativeOrder());
           textureBuffer = tbb.asFloatBuffer();
           textureBuffer.put(uvs);
           textureBuffer.position(0);

               mProgram = GLES20.glCreateProgram();             // create empty OpenGL Program
               compileShaders();
               setupTextures();
           }

           public void setupTextures() {
               yTextureHandle = setupTexture(null, textureWidth, textureHeight, 0);
               uTextureHandle = setupTexture(null, textureWidth, textureHeight, 1);
               vTextureHandle = setupTexture(null, textureWidth, textureHeight, 2);
           }

           public int setupTexture(ByteBuffer data, int width, int height, int index) {
               final int[] textureHandle = new int[1];

               GLES20.glGenTextures(1, textureHandle, 0);

               if (textureHandle[0] != 0) {
                       // Bind to the texture in OpenGL
                   GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + index);
                   GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[0]);

                   updateTexture(data, width, height, index);

                       // Set filtering
                   GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
                   GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);

                       // Set wrapping mode
                   GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT);
                   GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT);
               }

               if (textureHandle[0] == 0) {
                   Log.e(LOG_TAG, "Error loading texture.");
               }

               return textureHandle[0];
           }

           public void updateTexture(byte[] data, int width, int height, int index) {

               if (data == null) {
                   if (width == 0 || height == 0) {
                       width = textureWidth;
                       height = textureHeight;
                   }

                   data = new byte[width * height];
                   if (index == 0) {
                       Arrays.fill(data, y);
                   } else if (index == 1) {
                       Arrays.fill(data, u);
                   } else {
                       Arrays.fill(data, v);
                   }
               }

               byteBuffer.wrap(data);
               byteBuffer.position(0);

               GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + index);

               GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_LUMINANCE,
                   width, height, 0, GLES20.GL_LUMINANCE, GLES20.GL_UNSIGNED_BYTE, byteBuffer);
           }

           private void compileShaders() {
               // prepare shaders and OpenGL program
               int vertexShader = loadShader(
                   GLES20.GL_VERTEX_SHADER,
                   vertexShaderCode);
               int fragmentShader = loadShader(
                   GLES20.GL_FRAGMENT_SHADER,
                   fragmentShaderCode);

               GLES20.glAttachShader(mProgram, vertexShader);   // add the vertex shader to program
               GLES20.glAttachShader(mProgram, fragmentShader); // add the fragment shader to program
               GLES20.glLinkProgram(mProgram);                  // create OpenGL program executables
               checkGlError("glLinkProgram");

               // Add program to OpenGL environment
               GLES20.glUseProgram(mProgram);

               mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");
               mTextureCoordinateHandle = GLES20.glGetAttribLocation(mProgram, "a_TexCoordinate");

               GLES20.glEnableVertexAttribArray(mPositionHandle);
               GLES20.glEnableVertexAttribArray(mTextureCoordinateHandle);

               yTextureUniformHandle = GLES20.glGetUniformLocation(mProgram, "s_texture_y");
               uTextureUniformHandle = GLES20.glGetUniformLocation(mProgram, "s_Texture_u");
               vTextureUniformHandle = GLES20.glGetUniformLocation(mProgram, "s_Texture_v");

               mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
               checkGlError("glGetUniformLocation");
           }

       /**
        * Utility method for compiling a OpenGL shader.
        * <p></p>
        * <p><strong>Note:</strong> When developing shaders, use the checkGlError()
        * method to debug shader coding errors.</p>
        *
        * @param type       - Vertex or fragment shader type.
        * @param shaderCode - String containing the shader code.
        * @return - Returns an id for the shader.
        */
       public int loadShader(int type, String shaderCode) {

               // create a vertex shader type (GLES20.GL_VERTEX_SHADER)
               // or a fragment shader type (GLES20.GL_FRAGMENT_SHADER)
           int shader = GLES20.glCreateShader(type);

               // add the source code to the shader and compile it
           GLES20.glShaderSource(shader, shaderCode);
           GLES20.glCompileShader(shader);

           return shader;
       }

       /**
        * Utility method for debugging OpenGL calls. Provide the name of the call
        * just after making it:
        * <p></p>
        * <pre>
        * mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");
        * MyGLRenderer.checkGlError("glGetUniformLocation");</pre>
        *
        * If the operation is not successful, the check throws an error.
        *
        * @param glOperation - Name of the OpenGL call to check.
        */
       public void checkGlError(String glOperation) {
           int error;
           String errorString;
           while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
               errorString = GLU.gluErrorString(error);
               String message = glOperation + ": glError " + error + ": " + errorString;
               Log.e(LOG_TAG, message);
               throw new RuntimeException(message);
           }
       }

       public void draw(float[] mvpMatrix) {

               // Prepare the triangle coordinate data
           GLES20.glVertexAttribPointer(
               mPositionHandle, COORDS_PER_VERTEX,
               GLES20.GL_FLOAT, false,
               vertexStride, vertexBuffer);

           GLES20.glVertexAttribPointer(
               mTextureCoordinateHandle, COORDS_PER_TEXTURE,
               GLES20.GL_FLOAT, false,
               0, textureBuffer);

           GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);
           checkGlError("glUniformMatrix4fv");

           GLES20.glUniform1i(yTextureUniformHandle, 0);
           GLES20.glUniform1i(uTextureUniformHandle, 1);
           GLES20.glUniform1i(vTextureUniformHandle, 2);

               // Draw the square
           GLES20.glDrawElements(
               GLES20.GL_TRIANGLES, drawOrder.length,
               GLES20.GL_UNSIGNED_SHORT, drawListBuffer);
       }
    }

    But i have a problem there. My GL surface display image with wrong colors. image

    What i’m doing wrong ?

    UPDATE :

    As Ronald S. Bultje say, i added glBindTexture(...) function in my code. And now updateTexture(...) method looks like this :

    public void updateTexture(byte[] data, int width, int height, int index) {

       if (data == null) {
           if (width == 0 || height == 0) {
               width = textureWidth;
               height = textureHeight;
           }

           data = new byte[width * height];
           if (index == 0) {
               Arrays.fill(data, y);
           } else if (index == 1) {
               Arrays.fill(data, u);
           } else {
               Arrays.fill(data, v);
           }
       }

       byteBuffer.wrap(data);
       byteBuffer.position(0);

       GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + index);

       int textureHandle = index == 0 ? yTextureHandle : index == 1 ? uTextureHandle : vTextureHandle;
       GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle);

       GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_LUMINANCE,
           width, height, 0, GLES20.GL_LUMINANCE, GLES20.GL_UNSIGNED_BYTE, byteBuffer);
    }
  • FFMPEG error with avformat_open_input returning -135

    28 avril 2015, par LawfulEvil

    I have a DLL one of my applications uses to receive video from RTSP cameras. Under the hood, the DLL uses FFMPEG libs from this release zip :

    ffmpeg-20141022-git-6dc99fd-win64-shared.7z

    We have a wide variety of cameras in house and most of them work just fine. However, on one particular Pelco Model Number : IXE20DN-OCP, I am unable to connect. I tested the camera and rtsp connection string on VLC and it connects to the camera just fine.

    I found the connection string here : http://www.ispyconnect.com/man.aspx?n=Pelco

    rtsp://IPADDRESS:554/1/stream1

    Oddly, even if I leave the port off of VLC, it connects, so I’m guessing its the default RTSP port or that VLC tries a variety of things based on your input.

    In any case, when I attempt to connect, I get an error from av_format_open_input. It returns a code of -135. When I looked in the error code list I didn’t see that listed. For good measure, I printed out all the errors in error.h just to see what their values were.

    DumpErrorCodes - Error Code : AVERROR_BSF_NOT_FOUND = -1179861752
    DumpErrorCodes - Error Code : AVERROR_BUG = -558323010
    DumpErrorCodes - Error Code : AVERROR_BUFFER_TOO_SMALL = -1397118274
    DumpErrorCodes - Error Code : AVERROR_DECODER_NOT_FOUND = -1128613112
    DumpErrorCodes - Error Code : AVERROR_DEMUXER_NOT_FOUND = -1296385272
    DumpErrorCodes - Error Code : AVERROR_ENCODER_NOT_FOUND = -1129203192
    DumpErrorCodes - Error Code : AVERROR_EOF = -541478725
    DumpErrorCodes - Error Code : AVERROR_EXIT = -1414092869
    DumpErrorCodes - Error Code : AVERROR_EXTERNAL = -542398533
    DumpErrorCodes - Error Code : AVERROR_FILTER_NOT_FOUND = -1279870712
    DumpErrorCodes - Error Code : AVERROR_INVALIDDATA = -1094995529
    DumpErrorCodes - Error Code : AVERROR_MUXER_NOT_FOUND = -1481985528
    DumpErrorCodes - Error Code : AVERROR_OPTION_NOT_FOUND = -1414549496
    DumpErrorCodes - Error Code : AVERROR_PATCHWELCOME = -1163346256
    DumpErrorCodes - Error Code : AVERROR_PROTOCOL_NOT_FOUND = -1330794744
    DumpErrorCodes - Error Code : AVERROR_STREAM_NOT_FOUND = -1381258232
    DumpErrorCodes - Error Code : AVERROR_BUG2 = -541545794
    DumpErrorCodes - Error Code : AVERROR_UNKNOWN = -1313558101
    DumpErrorCodes - Error Code : AVERROR_EXPERIMENTAL = -733130664
    DumpErrorCodes - Error Code : AVERROR_INPUT_CHANGED = -1668179713
    DumpErrorCodes - Error Code : AVERROR_OUTPUT_CHANGED = -1668179714
    DumpErrorCodes - Error Code : AVERROR_HTTP_BAD_REQUEST = -808465656
    DumpErrorCodes - Error Code : AVERROR_HTTP_UNAUTHORIZED = -825242872
    DumpErrorCodes - Error Code : AVERROR_HTTP_FORBIDDEN = -858797304
    DumpErrorCodes - Error Code : AVERROR_HTTP_NOT_FOUND = -875574520
    DumpErrorCodes - Error Code : AVERROR_HTTP_OTHER_4XX = -1482175736
    DumpErrorCodes - Error Code : AVERROR_HTTP_SERVER_ERROR = -1482175992

    Nothing even close to -135. I did find this error, sort of on stack overflow, here runtime error when linking ffmpeg libraries in qt creator where the author claims it is a DLL loading problem error. I’m not sure what led him to think that, but I followed the advice and used the dependency walker (http://www.dependencywalker.com/) to checkout what dependencies it thought my DLL needed. It listed a few, but they were already provided in my install package.

    To make sure it was picking them up, I manually removed them from the install and observed a radical change in program behavior(that being my DLL didn’t load and start to run at all).

    So, I’ve got a bit of init code :

    void FfmpegInitialize()
    {
    av_lockmgr_register(&amp;LockManagerCb);
    av_register_all();
    LOG_DEBUG0("av_register_all returned\n");
    }

    Then I’ve got my main open connection routine ...

    int RTSPConnect(const char *URL, int width, int height, frameReceived callbackFunction)
    {

       int errCode =0;
       if ((errCode = avformat_network_init()) != 0)
       {
           LOG_ERROR1("avformat_network_init returned error code %d\n", errCode);  
       }
       LOG_DEBUG0("avformat_network_init returned\n");
       //Allocate space and setup the the object to be used for storing all info needed for this connection
       fContextReadFrame = avformat_alloc_context(); // free'd in the Close method

       if (fContextReadFrame == 0)
       {
           LOG_ERROR1("Unable to set rtsp_transport options.   Error code = %d\n", errCode);
           return FFMPEG_OPTION_SET_FAILURE;
       }

       LOG_DEBUG1("avformat_alloc_context returned %p\n", fContextReadFrame);

       AVDictionary *opts = 0;
       if ((errCode = av_dict_set(&amp;opts, "rtsp_transport", "tcp", 0)) &lt; 0)
       {
           LOG_ERROR1("Unable to set rtsp_transport options.   Error code = %d\n", errCode);
           return FFMPEG_OPTION_SET_FAILURE;
       }
       LOG_DEBUG1("av_dict_set returned %d\n", errCode);

       //open rtsp
       DumpErrorCodes();
       if ((errCode = avformat_open_input(&amp;fContextReadFrame, URL, NULL, &amp;opts)) &lt; 0)
       {
           LOG_ERROR2("Unable to open avFormat RF inputs.   URL = %s, and Error code = %d\n", URL, errCode);      
           LOG_ERROR2("Error Code %d = %s\n", errCode, errMsg(errCode));      
           // NOTE context is free'd on failure.
           return FFMPEG_FORMAT_OPEN_FAILURE;
       }
    ...

    To be sure I didn’t misunderstand the error code I printed the error message from ffmpeg but the error isn’t found and my canned error message is returned instead.

    My next step was going to be hooking up wireshark on my connection attempt and on the VLC connection attempt and trying to figure out what differences(if any) are causing the problem and what I can do to ffmpeg to make it work. As I said, I’ve got a dozen other cameras in house that use RTSP and they work with my DLL. Some utilize usernames/passwords/etc as well(so I know that isn’t the problem).

    Also, my run logs :

    FfmpegInitialize - av_register_all returned
    Open - Open called.  Pointers valid, passing control.
    Rtsp::RtspInterface::Open - Rtsp::RtspInterface::Open called
    Rtsp::RtspInterface::Open - VideoSourceString(35) = rtsp://192.168.14.60:554/1/stream1
    Rtsp::RtspInterface::Open - Base URL = (192.168.14.60:554/1/stream1)
    Rtsp::RtspInterface::Open - Attempting to open (rtsp://192.168.14.60:554/1/stream1) for WxH(320x240) video
    RTSPSetFormatH264 - RTSPSetFormatH264
    RTSPConnect - Called
    LockManagerCb - LockManagerCb invoked for op 1
    LockManagerCb - LockManagerCb invoked for op 2
    RTSPConnect - avformat_network_init returned
    RTSPConnect - avformat_alloc_context returned 019E6000
    RTSPConnect - av_dict_set returned 0
    DumpErrorCodes - Error Code : AVERROR_BSF_NOT_FOUND = -1179861752
    ...
    DumpErrorCodes - Error Code : AVERROR_HTTP_SERVER_ERROR = -1482175992
    RTSPConnect - Unable to open avFormat RF inputs.   URL = rtsp://192.168.14.60:554/1/stream1, and Error code = -135
    RTSPConnect - Error Code -135 = No Error Message Available

    I’m going to move forward with wireshark but would like to know the origin of the -135 error code from ffmpeg. When I look at the code if ’ret’ is getting set to -135, it must be happening as a result of the return code from a helper method and not directly in the avformat_open_input method.

    https://www.ffmpeg.org/doxygen/2.5/libavformat_2utils_8c_source.html#l00398

    After upgrading to the latest daily ffmpeg build, I get data on wireshark. Real Time Streaming Protocol :

    Request: SETUP rtsp://192.168.14.60/stream1/track1 RTSP/1.0\r\n
    Method: SETUP
    URL: rtsp://192.168.14.60/stream1/track1
    Transport: RTP/AVP/TCP;unicast;interleaved=0-1
    CSeq: 3\r\n
    User-Agent: Lavf56.31.100\r\n
    \r\n

    The response to that is the first ’error’ that I can detect in the initiation.

    Response: RTSP/1.0 461 Unsupported Transport\r\n
    Status: 461
    CSeq: 3\r\n
    Date: Sun, Jan 04 1970 16:03:05 GMT\r\n
    \r\n

    I’m going to guess that... it means the transport we selected was unsupported. I quick check of the code reveals I picked ’tcp’. Looking through the reply to the DESCRIBE command, it appears :

    Media Protocol: RTP/AVP

    Further, when SETUP is issued by ffmpeg, it specifies :

    Transport: RTP/AVP/TCP;unicast;interleaved=0-1

    I’m going to try, on failure here to pick another transport type and see how that works. Still don’t know where the -135 comes from.

  • Revision 60e01c6530 : Account for eob cost in the RTC mode decision process This commit accounts for

    3 avril 2015, par Jingning Han

    Changed Paths :
     Modify /vp9/encoder/vp9_pickmode.c



    Account for eob cost in the RTC mode decision process

    This commit accounts for the transform block end of coefficient flag
    cost in the RTC mode decision process. This allows a more precise
    rate estimate. It also turns on the model to block sizes up to 32x32.
    The test sequences shows about 3% - 5% speed penalty for speed -6.
    The average compression performance improvement for speed -6 is
    1.58% in PSNR. The compression gains for hard clips like jimredvga,
    mmmoving, and tacomascmv at low bit-rate range are 1.8%, 2.1%, and
    3.2%, respectively.

    Change-Id : Ic2ae211888e25a93979eac56b274c6e5ebcc21fb