Recherche avancée

Médias (91)

Autres articles (30)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (4856)

  • how can I copy file frame by frame to get exactly the same file ? (FFmpeg)

    14 février 2018, par user3360601

    I was using an ffmpeg example from original source remuxing.c to copy file by frames. It works, but the result file has another structure inside. enter image description here

    From the left is original file. It has "framerate" field. Moreover, the copy file has smaller size. On 18 bytes less.

    Question : how can I copy file frame by frame to get exactly the same file ? Including "framerate" field and total size ?

    Code from the source site.

       /*
    * Copyright (c) 2013 Stefano Sabatini
    *
    * Permission is hereby granted, free of charge, to any person obtaining a copy
    * of this software and associated documentation files (the "Software"), to deal
    * in the Software without restriction, including without limitation the rights
    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    * copies of the Software, and to permit persons to whom the Software is
    * furnished to do so, subject to the following conditions:
    *
    * The above copyright notice and this permission notice shall be included in
    * all copies or substantial portions of the Software.
    *
    * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    * THE SOFTWARE.
    */

    /**
    * @file
    * libavformat/libavcodec demuxing and muxing API example.
    *
    * Remux streams from one container format to another.
    * @example remuxing.c
    */

    #include <libavutil></libavutil>timestamp.h>
    #include <libavformat></libavformat>avformat.h>

    static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, const char *tag)
    {
       AVRational *time_base = &amp;fmt_ctx->streams[pkt->stream_index]->time_base;

       printf("%s: pts:%s pts_time:%s dts:%s dts_time:%s duration:%s duration_time:%s stream_index:%d\n",
              tag,
              av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, time_base),
              av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, time_base),
              av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, time_base),
              pkt->stream_index);
    }

    int main(int argc, char **argv)
    {
       AVOutputFormat *ofmt = NULL;
       AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
       AVPacket pkt;
       const char *in_filename, *out_filename;
       int ret, i;
       int stream_index = 0;
       int *stream_mapping = NULL;
       int stream_mapping_size = 0;

       if (argc &lt; 3) {
           printf("usage: %s input output\n"
                  "API example program to remux a media file with libavformat and libavcodec.\n"
                  "The output format is guessed according to the file extension.\n"
                  "\n", argv[0]);
           return 1;
       }

       in_filename  = argv[1];
       out_filename = argv[2];

       av_register_all();

       if ((ret = avformat_open_input(&amp;ifmt_ctx, in_filename, 0, 0)) &lt; 0) {
           fprintf(stderr, "Could not open input file '%s'", in_filename);
           goto end;
       }

       if ((ret = avformat_find_stream_info(ifmt_ctx, 0)) &lt; 0) {
           fprintf(stderr, "Failed to retrieve input stream information");
           goto end;
       }

       av_dump_format(ifmt_ctx, 0, in_filename, 0);

       avformat_alloc_output_context2(&amp;ofmt_ctx, NULL, NULL, out_filename);
       if (!ofmt_ctx) {
           fprintf(stderr, "Could not create output context\n");
           ret = AVERROR_UNKNOWN;
           goto end;
       }

       stream_mapping_size = ifmt_ctx->nb_streams;
       stream_mapping = av_mallocz_array(stream_mapping_size, sizeof(*stream_mapping));
       if (!stream_mapping) {
           ret = AVERROR(ENOMEM);
           goto end;
       }

       ofmt = ofmt_ctx->oformat;

       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++) {
           AVStream *out_stream;
           AVStream *in_stream = ifmt_ctx->streams[i];
           AVCodecParameters *in_codecpar = in_stream->codecpar;

           if (in_codecpar->codec_type != AVMEDIA_TYPE_AUDIO &amp;&amp;
               in_codecpar->codec_type != AVMEDIA_TYPE_VIDEO &amp;&amp;
               in_codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE) {
               stream_mapping[i] = -1;
               continue;
           }

           stream_mapping[i] = stream_index++;

           out_stream = avformat_new_stream(ofmt_ctx, NULL);
           if (!out_stream) {
               fprintf(stderr, "Failed allocating output stream\n");
               ret = AVERROR_UNKNOWN;
               goto end;
           }

           ret = avcodec_parameters_copy(out_stream->codecpar, in_codecpar);
           if (ret &lt; 0) {
               fprintf(stderr, "Failed to copy codec parameters\n");
               goto end;
           }
           out_stream->codecpar->codec_tag = 0;
       }
       av_dump_format(ofmt_ctx, 0, out_filename, 1);

       if (!(ofmt->flags &amp; AVFMT_NOFILE)) {
           ret = avio_open(&amp;ofmt_ctx->pb, out_filename, AVIO_FLAG_WRITE);
           if (ret &lt; 0) {
               fprintf(stderr, "Could not open output file '%s'", out_filename);
               goto end;
           }
       }

       ret = avformat_write_header(ofmt_ctx, NULL);
       if (ret &lt; 0) {
           fprintf(stderr, "Error occurred when opening output file\n");
           goto end;
       }

       while (1) {
           AVStream *in_stream, *out_stream;

           ret = av_read_frame(ifmt_ctx, &amp;pkt);
           if (ret &lt; 0)
               break;

           in_stream  = ifmt_ctx->streams[pkt.stream_index];
           if (pkt.stream_index >= stream_mapping_size ||
               stream_mapping[pkt.stream_index] &lt; 0) {
               av_packet_unref(&amp;pkt);
               continue;
           }

           pkt.stream_index = stream_mapping[pkt.stream_index];
           out_stream = ofmt_ctx->streams[pkt.stream_index];
           log_packet(ifmt_ctx, &amp;pkt, "in");

           /* copy packet */
           pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
           pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
           pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
           pkt.pos = -1;
           log_packet(ofmt_ctx, &amp;pkt, "out");

           ret = av_interleaved_write_frame(ofmt_ctx, &amp;pkt);
           if (ret &lt; 0) {
               fprintf(stderr, "Error muxing packet\n");
               break;
           }
           av_packet_unref(&amp;pkt);
       }

       av_write_trailer(ofmt_ctx);
    end:

       avformat_close_input(&amp;ifmt_ctx);

       /* close output */
       if (ofmt_ctx &amp;&amp; !(ofmt->flags &amp; AVFMT_NOFILE))
           avio_closep(&amp;ofmt_ctx->pb);
       avformat_free_context(ofmt_ctx);

       av_freep(&amp;stream_mapping);

       if (ret &lt; 0 &amp;&amp; ret != AVERROR_EOF) {
           fprintf(stderr, "Error occurred: %s\n", av_err2str(ret));
           return 1;
       }

       return 0;
    }
  • Getting this error in next js 13 app router “Module not found : Can't resolve './lib-cov/fluent-ffmpeg'”

    14 novembre 2023, par Aamir Khan

    I want to convert mp4 to mp3 using the npm package 'fluent-ffmpeg’, in the express application it is working fine but not in NextJS 13, And even after removing the node_modules folder, package-lock.js and doing "npm install" again, it still didn't work. Does anyone have a solution for this ?

    &#xA;

    This error is coming in the console.

    &#xA;

    > my-app@0.1.0 dev&#xA;> next dev&#xA;&#xA;   ▲ Next.js 14.0.2&#xA;   - Local:        http://localhost:3000&#xA;   - Environments: .env.local&#xA;&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/next isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/next isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA; ✓ Ready in 2.2s&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-ia32-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-x64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-arm64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-darwin-x64 isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA; ⨯ ./node_modules/fluent-ffmpeg/index.js:1:48&#xA;Module not found: Can&#x27;t resolve &#x27;./lib-cov/fluent-ffmpeg&#x27;&#xA;&#xA;https://nextjs.org/docs/messages/module-not-found&#xA;&#xA;Import trace for requested module:&#xA;./src/app/api/new/route.js&#xA; ○ Compiling /not-found ...&#xA;(node:3236) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.&#xA;(Use `node --trace-deprecation ...` to show where the warning was created)&#xA; ⨯ ./node_modules/fluent-ffmpeg/index.js:1:48&#xA;Module not found: Can&#x27;t resolve &#x27;./lib-cov/fluent-ffmpeg&#x27;&#xA;&#xA;https://nextjs.org/docs/messages/module-not-found&#xA;&#xA;Import trace for requested module:&#xA;./src/app/api/new/route.js&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/next isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA; ⨯ ./node_modules/fluent-ffmpeg/index.js:1:48&#xA;Module not found: Can&#x27;t resolve &#x27;./lib-cov/fluent-ffmpeg&#x27;&#xA;&#xA;https://nextjs.org/docs/messages/module-not-found&#xA;&#xA;Import trace for requested module:&#xA;./src/app/api/new/route.js&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-ia32-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-darwin-x64 isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-arm64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-x64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-ia32-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-arm64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-x64-msvc isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-musl isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-darwin-x64 isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-gnu isn&#x27;t a directory or doesn&#x27;t contain a package.json (see snapshot.managedPaths option)&#xA;</w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w></w>

    &#xA;

    I also tried creating the webpack.config.js file in the root directory of the project but it did not work

    &#xA;

    &lt;

    &#xA;

    import webpack from &#x27;webpack&#x27;&#xA;&#xA;module.exports = {&#xA;  plugins: [&#xA;    new webpack.DefinePlugin({&#xA;      &#x27;process.env.FLUENTFFMPEG_COV&#x27;: JSON.stringify(false),&#xA;    }),&#xA;  ],&#xA;};&#xA;

    &#xA;

    >

    &#xA;

    This is my src/app/api/new/route.js file code

    &#xA;

    import { NextResponse, NextRequest } from "next/server";&#xA;import ffmpeg from &#x27;fluent-ffmpeg&#x27;&#xA;var command = ffmpeg()&#xA;&#xA;export function GET(){&#xA;&#xA;    command.input(&#x27;mp4/video.mp4&#x27;)&#xA;    &#xA;    .save(&#x27;converted/audio.mp3&#x27;)&#xA;&#xA;    return NextResponse.json(&#x27;Done&#x27;)&#xA;}&#xA;

    &#xA;

    This is next.config.js file

    &#xA;

    /** @type {import(&#x27;next&#x27;).NextConfig} */&#xA;&#xA;const nextConfig = {}&#xA;&#xA;module.exports = nextConfig&#xA;

    &#xA;

    This is package.js file

    &#xA;

    {&#xA;  "name": "my-app",&#xA;  "version": "0.1.0",&#xA;  "private": true,&#xA;  "scripts": {&#xA;    "dev": "next dev",&#xA;    "build": "next build",&#xA;    "start": "next start",&#xA;    "lint": "next lint"&#xA;  },&#xA;  "dependencies": {&#xA;    "ffmpeg": "^0.0.4",&#xA;    "fluent-ffmpeg": "^2.1.2",&#xA;    "next": "14.0.2",&#xA;    "react": "^18",&#xA;    "react-dom": "^18",&#xA;    "webpack": "^5.89.0"&#xA;  }&#xA;}&#xA;

    &#xA;

    How to fix this error ?

    &#xA;

  • java.lang.UnsatisfiedLinkError : Couldn't load ffmpeg library findLibrary returned null

    22 février 2017, par Muthukumar Subramaniam

    I am new to live streaming from android to youtube in android. I mentioned my Project Structrue and build the gradle file in android. FFmpeg library could not load in runtime.

    Note : I am working in windows 10 and android studio 2.1.2

       apply plugin: 'com.android.application'

    android {
       compileSdkVersion 23
       buildToolsVersion "23.0.1"

       packagingOptions {
           exclude 'META-INF/DEPENDENCIES'
           exclude 'META-INF/NOTICE'
           exclude 'META-INF/NOTICE.txt'
           exclude 'META-INF/LICENSE'
           exclude 'META-INF/LICENSE.txt'
       }

       defaultConfig {
           applicationId "com.ephron.mobilizerapp"
           minSdkVersion 14
           targetSdkVersion 23
           versionCode 1
           versionName "1.4"
           multiDexEnabled true
       }
       dexOptions {
           javaMaxHeapSize "4g"
       }


       buildTypes {
           release {
               minifyEnabled false
               proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
           }
       }
       sourceSets {
           main {
               assets.srcDirs = ['src/main/assets', 'src/main/assets/']

           }
       }
       sourceSets { main {
           jni.srcDirs = ['src/main/jni', 'src/main/jni/libs']
           jni.srcDirs = ['libs']
           jni.srcDirs = []
       } }
    }

    dependencies {
       testCompile 'junit:junit:4.12'
       compile files('libs/httpclient-4.5.2.jar')
       compile files('libs/httpcore-4.4.4.jar')
       compile files('libs/httpmime-4.2.1.jar')
       compile files('libs/YouTubeAndroidPlayerApi.jar')
       compile 'com.android.support:appcompat-v7:23.1.0'
       compile 'com.google.android.gms:play-services:10.0.1'
       compile 'com.google.code.gson:gson:2.2.2'
       compile 'com.google.firebase:firebase-messaging:9.2.0'
       compile 'testfairy:testfairy-android-sdk:1.+@aar'
       compile 'com.android.support:multidex:1.0.0'
       compile 'com.mcxiaoke.volley:library:1.0.19'
       compile 'com.squareup.picasso:picasso:2.5.2'
       compile 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
       compile 'com.google.android.gms:play-services-maps:10.0.1'
       compile 'com.google.apis:google-api-services-youtube:v3-rev182-1.22.0'
       compile 'com.google.api-client:google-api-client-android:1.22.0'
       compile 'com.google.http-client:google-http-client-gson:1.19.0'
       compile 'com.google.android.gms:play-services-ads:10.0.1'
       compile 'com.google.android.gms:play-services-auth:10.0.1'
       compile 'com.google.android.gms:play-services-gcm:10.0.1'
       compile files('libs/ffmpeg-android.jar')
    }
    apply plugin: 'com.google.gms.google-services'

    My Project Structure mentioned below Link

    https://www.screencast.com/t/E0TFsMUi1

    Application.mk file

       APP_OPTIM := release
    APP_ABI := all
    APP_STL := gnustl_static
    APP_CPPFLAGS := -frtti -fexceptions

    Android.mk file

      #
    # Copyright (c) 2014 Google Inc.
    #
    # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
    # in compliance with the License. You may obtain a copy of the License at
    #
    # http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software distributed under the License
    # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
    # or implied. See the License for the specific language governing permissions and limitations under
    # the License.


    # set NDK_PROJECT_PATH := D:/MobilizerApp/app/src/main/jni

    WORKING_DIR := $(call my-dir)

    include $(CLEAR_VARS)
    LOCAL_PATH := $(WORKING_DIR)/../third_party/lame/libmp3lame
    LOCAL_MODULE    := lame
    LOCAL_C_INCLUDES := $(WORKING_DIR)/../third_party/lame/libmp3lame \
                       $(WORKING_DIR)/../third_party/lame/include
    LOCAL_CFLAGS := -DSTDC_HEADERS -std=c99
    LOCAL_ARM_MODE := arm
    APP_OPTIM := release

    LOCAL_SRC_FILES := VbrTag.c \
                      bitstream.c \
                      encoder.c \
                      fft.c \
                      gain_analysis.c \
                      id3tag.c \
                      lame.c \
                      mpglib_interface.c \
                      newmdct.c \
                      presets.c \
                      psymodel.c \
                      quantize.c \
                      quantize_pvt.c \
                      reservoir.c \
                      set_get.c \
                      tables.c \
                      takehiro.c \
                      util.c \
                      vbrquantize.c \
                      version.c


    #include $(BUILD_STATIC_LIBRARY)

    include $(BUILD_STATIC_LIBRARY)

    #include $(CLEAR_VARS)
    #LOCAL_MODULE  := mp3lame_a
    #LOCAL_STATIC_LIBRARIES := lame

    #include $(BUILD_EXECUTABLE)

    include $(CLEAR_VARS)
    LOCAL_PATH := $(WORKING_DIR)
    LOCAL_MODULE    := ffmpeg
    LOCAL_CFLAGS := -DHAVE_AV_CONFIG_H -std=c99 -D__STDC_CONSTANT_MACROS -DSTDC_HEADERS -Wno-deprecated-declarations
    LOCAL_SRC_FILES := ffmpeg-jni.c
    LOCAL_C_INCLUDES := $(WORKING_DIR)/libavcodec $(WORKING_DIR)/libavcodec/arm $(WORKING_DIR)/libavformat $(WORKING_DIR)/libavutil $(WORKING_DIR)/libavutil/arm

    LOCAL_STATIC_LIBRARIES := lame

    LOCAL_LDLIBS := -llog -lm -lz $(WORKING_DIR)/../third_party/lib/libavformat.a $(WORKING_DIR)/../third_party/lib/libavcodec.a $(WORKING_DIR)/../third_party/lib/libavfilter.a $(WORKING_DIR)/../third_party/lib/libavresample.a $(WORKING_DIR)/../third_party/lib/libswscale.a $(WORKING_DIR)/../third_party/lib/libavutil.a $(WORKING_DIR)/../third_party/lib/libx264.a $(WORKING_DIR)/../third_party/lib/libpostproc.a $(WORKING_DIR)/../third_party/lib/libswresample.a $(WORKING_DIR)/../third_party/lib/libfdk-aac.a

    APP_OPTIM := release

    include $(BUILD_SHARED_LIBRARY)

    FFMPEG.Java

    package com.ephronsystem.mobilizerapp;


    public class Ffmpeg {


       static {
           System.loadLibrary("ffmpeg");
       }

       public static native boolean init(int width, int height, int audio_sample_rate, String rtmpUrl);

       public static native void shutdown();

       // Returns the size of the encoded frame.
       public static native int encodeVideoFrame(byte[] yuv_image);

       public static native int encodeAudioFrame(short[] audio_data, int length);
    }