Recherche avancée

Médias (91)

Autres articles (34)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (8018)

  • iOS 17’s Impact on Marketing : Navigating Privacy Changes

    22 septembre 2023, par Erin — Analytics Tips, Marketing

    In the ever-evolving landscape of digital marketing, staying up-to-date with the latest changes is paramount. One such significant change came on 18 September 2023, in the form of iOS 17, Apple’s latest operating system update. With iOS 17, Apple has introduced new privacy features that are set to have a profound impact on marketers and how they track and analyse user behaviour. 

    In this blog, we will explore what iOS 17 is, how it affects tracking, which tracking parameters are impacted, what remains unaffected, and most importantly, how marketers can future-proof their campaign tracking URLs.

    What is iOS 17 ?

    iOS 17 is the latest update to Apple’s mobile operating system, used on millions of iPhones worldwide. While iOS updates often bring new features and improvements, iOS 17 has made waves in the digital marketing community due to its emphasis on user privacy.

    How does iOS 17 affect tracking ?

    One of the key features of iOS 17 that concerns marketers is its impact on tracking. Apple’s new update aims to enhance user privacy by limiting the information that can be tracked and collected by third-party entities, particularly through query parameters in URLs. This means that certain tracking mechanisms that marketers have relied on for years are now rendered ineffective on iOS 17 devices.

    Campaign tracking URLs, also known as tracking parameters or UTM parameters, are special codes added to the end of URLs. They are used by marketers to track various aspects of a user’s interaction with a digital marketing campaign. These parameters provide valuable data, such as the source of traffic, the medium through which users arrived and specific campaign details.

    For example, with Matomo (mtm) tracking parameters, a campaign tracking URL might look like this :

    https://www.example.com/products/example_product?mtm_campaign=summer-sale

    Generated Campaign URL

    Understanding the impact of iOS 17 on campaign tracking URLs is essential for marketers who rely on this data to measure the effectiveness of their marketing campaigns.

    Which campaign tracking parameters are affected by iOS 17 ?

    Several tracking parameters commonly used by marketers will no longer work as expected on iOS 17. Some of these include :

    • Facebook (fbclid) : Employed for tracking Facebook advertising campaigns. 
    • Instagram (igshid) : Used to track user interactions with Instagram ads.
    • Google Ads (gclid) : Used to track Google Ads campaigns. 
    • Twitter (twclid) : Used to track user interactions with Twitter ads. 
    • Microsoft Ads (msclkid) : Employed for tracking Microsoft Ads campaigns. 
    • Mailchimp (mc_eid) : Used by Mailchimp for email campaign tracking. 

    These changes are significant, as they disrupt many of the common tracking methods that marketers rely on to measure the effectiveness of their campaigns.

    Which campaign tracking parameters are not affected by iOS 17 ?

    While many tracking parameters have been impacted, there are still some that remain unaffected on iOS 17. However, it’s important to note that the status of these parameters might change in the future as Apple continues to prioritise user privacy. Some of the tracking parameters that are still working as of now include :

    • Matomo (mtm) : Matomo campaign tracking parameters. 
    • Google Analytics (UTMs) : Google Analytics campaign tracking parameters.
    • Pinterest (epik) : Used for tracking Pinterest campaigns. 
    • Klaviyo (_kx) : Klaviyo for email marketing tracking. 
    • TikTok (tt-) : Used for tracking TikTok ad interactions. 
    • Hubspot (hsa) : Used for tracking Hubspot campaigns. 

    While these parameters offer some reprieve for marketers, it’s essential to keep a close eye on any potential changes in their functionality as Apple continues to roll out privacy-friendly features.

    How are Matomo users impacted ?

    Fortunately, Matomo, as a leading privacy-friendly web analytics solution, remains unaffected by the changes introduced by iOS 17. Specifically :

    For Matomo users who rely on mtm or UTMs

    If you’re using Matomo or GA tracking parameters, you can rest assured that iOS 17’s changes won’t affect your tracking capabilities in Matomo.

    Attention to gclids (Google Ads) and msclkid (Bing Ads)

    If you use Google Ads or Bing Ads tracking parameters with Matomo’s Advertising Conversion Export feature for tracking, iOS 17 presents a challenge. Your gclids and msclkids may not provide the same level of tracking accuracy on Apple mobile devices. This is a critical consideration, especially if your ad campaigns target mobile users.

    To stay informed about changes in the digital marketing landscape, including updates related to iOS 17, sign up for our newsletter where we regularly provide updates and insights on adapting your tracking and marketing strategies to ensure compliance and respect user privacy.

    How to future-proof your campaign tracking

    Given the impact of iOS 17 on tracking, it’s crucial for marketers to adapt and future-proof their campaign tracking strategies. Here are some steps you can take to mitigate the affects of iOS 17 on your marketing campaigns :

    Monitor platform updates

    Expect updates from advertising and analytics platforms in response to Apple’s privacy changes. These platforms are likely to develop alternative tracking methods or adapt existing ones to comply with iOS 17’s restrictions. Stay informed about these updates and incorporate them into your tracking strategy.

    Prioritise privacy-friendly tech stacks

    In the ever-evolving digital marketing landscape, it’s crucial to prioritise privacy-friendly tech stacks. Privacy-friendly tracking tools like Matomo are essential for maintaining trust and respecting user privacy.

    Matomo ensures the privacy of your users and analytics data. When using Matomo, you retain control of your data ; nobody else does. This commitment to user privacy aligns with the changing digital marketing landscape, where privacy is taking centre stage.

    Transition from affected campaign tracking parameters

    If you’ve been using tools like Mailchimp, whose campaign tracking URLs have been affected by iOS 17, consider transitioning to the campaign tracking URL parameters of your analytics solution. Whether you choose Matomo or Google Analytics, these solutions can help you understand how your email marketing campaigns are performing.

    Focus on data privacy compliance

    Embrace data privacy compliance practices. As privacy regulations evolve, it’s essential to prioritise transparency in data collection. Ensure that your tracking methods align with privacy standards to maintain trust with your audience.

    Regularly review and adapt

    The digital marketing landscape is dynamic, and iOS 17 is just one example of how quickly things can change. Regularly review your tracking methods and adapt to new developments in the industry. Staying agile and informed is key to long-term success.

    Marketers’ path forward

    iOS 17 has reshaped mobile user privacy, challenging marketers to adapt. While some tracking parameters are affected, savvy marketers can still thrive by embracing unique tracking solutions, staying informed about platform updates, and prioritising data privacy. 

    Explore Matomo for privacy-friendly analytics and navigate this evolving landscape successfully with our 21-day free trial – no credit card required. 

  • FFmpeg transcoding video H.264 -> AV1 leads to distorted image

    21 juin 2023, par user1584149

    I'm reading video from stdin via pipe similar to this one Python gets stuck at pipe.stdin.write(image.tostring())

    


    FFmpeg is using libsvtav1 codec with options according to documentation

    


    ffmpeg -y -f rawvideo -i pipe:0 -s {frame_width}x{frame_height} -r {frame_rate} -c:a copy -c:v libsvtav1 -preset 6 -crf 30 -svtav1-params "color-format=1:film-grain-denoise=0:mbr=2M" {output_file} 


    


    Here's couple of details about used FFmpeg version as well as input video

    


    ffmpeg version n5.1.3-14-ge5b5dd6653-20230621 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 13.1.0 (crosstool-NG 1.25.0.196_227d99d)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --disable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --disable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20230621
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, rawvideo, from 'pipe:0':
  Duration: N/A, start: 0.000000, bitrate: 331776 kb/s
  Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, 331776 kb/s, 30 tbr, 30 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> av1 (libsvtav1))
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:   SVT-AV1 Encoder Lib v1.5.0-12-g0f8b3a81
Svt[info]: SVT [build]  :   GCC 13.1.0   64 bit
Svt[info]: LIB Build date: Jun 20 2023 23:48:14
Svt[info]: -------------------------------------------


    


    The output video transcoded by SVT-AV1 codec is blemished as you can see on the images below. Normally I would say it could be caused by wrong pixel format, but input stream has yuv420 format what is the same as encoder's pixel format parameter —color-format.

    


    Please share your experience or ideas how to get it transcoding correctly.

    


    Thanks in advance.

    


    Image 1
Image 2

    


  • Ffmpeg in Android Studio

    7 décembre 2016, par Ahmed Abd-Elmeged

    i’am trying to add Ffmpeg library to use it in Live Streaming app based in Youtube APi when i add it and i use Cmake Build tool the header files only shown in the c native class which i create and i want it to be included in the other header files
    which came with library how can i do it in cmake script or onther way ?

    This my cmake build script

    # Sets the minimum version of CMake required to build the native
    # library. You should either keep the default value or only pass a
    # value of 3.4.0 or lower.

    cmake_minimum_required(VERSION 3.4.1)

    # Creates and names a library, sets it as either STATIC
    # or SHARED, and provides the relative paths to its source code.
    # You can define multiple libraries, and CMake builds it for you.
    # Gradle automatically packages shared libraries with your APK.

    add_library( # Sets the name of the library.
                ffmpeg-jni

                # Sets the library as a shared library.
                SHARED

                # Provides a relative path to your source file(s).
                # Associated headers in the same location as their source
                # file are automatically included.
                src/main/cpp/ffmpeg-jni.c )

    # Searches for a specified prebuilt library and stores the path as a
    # variable. Because system libraries are included in the search path by
    # default, you only need to specify the name of the public NDK library
    # you want to add. CMake verifies that the library exists before
    # completing its build.

    find_library( # Sets the name of the path variable.
                 log-lib

                 # Specifies the name of the NDK library that
                 # you want CMake to locate.
                 log )

    # Specifies libraries CMake should link to your target library. You
    # can link multiple libraries, such as libraries you define in the
    # build script, prebuilt third-party libraries, or system libraries.

    target_link_libraries( # Specifies the target library.
                          ffmpeg-jni

                          # Links the target library to the log library
                          # included in the NDK.
                          ${log-lib} )

    include_directories(src/main/cpp/include/ffmpeglib)

    include_directories(src/main/cpp/include/libavcodec)

    include_directories(src/main/cpp/include/libavformat)

    include_directories(src/main/cpp/include/libavutil)

    This my native class i create as native file i android studio and i also have an error in jintJNIcall not found

    #include <android></android>log.h>
    #include
    #include

    #include "libavcodec/avcodec.h"
    #include "libavformat/avformat.h"
    #include "libavutil/opt.h"



    #ifdef __cplusplus
    extern "C" {
    #endif

    JNIEXPORT jboolean
    JNICALL Java_com_example_venrto_ffmpegtest_Ffmpeg_init(JNIEnv *env, jobject thiz,
                                                            jint width, jint height,
                                                            jint audio_sample_rate,
                                                            jstring rtmp_url);
    JNIEXPORT void JNICALL Java_com_example_venrto_ffmpegtest_Ffmpeg_shutdown(JNIEnv
                                                                               *env,
                                                                               jobject thiz
    );
    JNIEXPORT jintJNICALL
           Java_com_example_venrto_ffmpegtest_Ffmpeg_encodeVideoFrame(JNIEnv
                                                                        *env,
                                                                        jobject thiz,
                                                                        jbyteArray
                                                                        yuv_image);
    JNIEXPORT jint
    JNICALL Java_com_example_venrto_ffmpegtest_Ffmpeg_encodeAudioFrame(JNIEnv *env,
                                                                        jobject thiz,
                                                                        jshortArray audio_data,
                                                                        jint length);

    #ifdef __cplusplus
    }
    #endif

    #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, "ffmpeg-jni", __VA_ARGS__)
    #define URL_WRONLY 2
    static AVFormatContext *fmt_context;
    static AVStream *video_stream;
    static AVStream *audio_stream;

    static int pts
           = 0;
    static int last_audio_pts = 0;

    // Buffers for UV format conversion
    static unsigned char *u_buf;
    static unsigned char *v_buf;

    static int enable_audio = 1;
    static int64_t audio_samples_written = 0;
    static int audio_sample_rate = 0;

    // Stupid buffer for audio samples. Not even a proper ring buffer
    #define AUDIO_MAX_BUF_SIZE 16384  // 2x what we get from Java
    static short audio_buf[AUDIO_MAX_BUF_SIZE];
    static int audio_buf_size = 0;

    void AudioBuffer_Push(const short *audio, int num_samples) {
       if (audio_buf_size >= AUDIO_MAX_BUF_SIZE - num_samples) {
           LOGI("AUDIO BUFFER OVERFLOW: %i + %i > %i", audio_buf_size, num_samples,
                AUDIO_MAX_BUF_SIZE);
           return;
       }
       for (int i = 0; i &lt; num_samples; i++) {
           audio_buf[audio_buf_size++] = audio[i];
       }
    }

    int AudioBuffer_Size() { return audio_buf_size; }

    short *AudioBuffer_Get() { return audio_buf; }

    void AudioBuffer_Pop(int num_samples) {
       if (num_samples > audio_buf_size) {
           LOGI("Audio buffer Pop WTF: %i vs %i", num_samples, audio_buf_size);
           return;
       }
       memmove(audio_buf, audio_buf + num_samples, num_samples * sizeof(short));
       audio_buf_size -= num_samples;
    }

    void AudioBuffer_Clear() {
       memset(audio_buf, 0, sizeof(audio_buf));
       audio_buf_size = 0;
    }

    static void log_callback(void *ptr, int level, const char *fmt, va_list vl) {
       char x[2048];
       vsnprintf(x, 2048, fmt, vl);
       LOGI(x);
    }

    JNIEXPORT jboolean
    JNICALL Java_com_example_venrto_ffmpegtest_Ffmpeg_init(JNIEnv *env, jobject thiz,
                                                            jint width, jint height,
                                                            jint audio_sample_rate_param,
                                                            jstring rtmp_url) {
       avcodec_register_all();
       av_register_all();
       av_log_set_callback(log_callback);

       fmt_context = avformat_alloc_context();
       AVOutputFormat *ofmt = av_guess_format("flv", NULL, NULL);
       if (ofmt) {
           LOGI("av_guess_format returned %s", ofmt->long_name);
       } else {
           LOGI("av_guess_format fail");
           return JNI_FALSE;
       }

       fmt_context->oformat = ofmt;
       LOGI("creating video stream");
       video_stream = av_new_stream(fmt_context, 0);

       if (enable_audio) {
           LOGI("creating audio stream");
           audio_stream = av_new_stream(fmt_context, 1);
       }

       // Open Video Codec.
       // ======================
       AVCodec *video_codec = avcodec_find_encoder(AV_CODEC_ID_H264);
       if (!video_codec) {
           LOGI("Did not find the video codec");
           return JNI_FALSE;  // leak!
       } else {
           LOGI("Video codec found!");
       }
       AVCodecContext *video_codec_ctx = video_stream->codec;
       video_codec_ctx->codec_id = video_codec->id;
       video_codec_ctx->codec_type = AVMEDIA_TYPE_VIDEO;
       video_codec_ctx->level = 31;

       video_codec_ctx->width = width;
       video_codec_ctx->height = height;
       video_codec_ctx->pix_fmt = PIX_FMT_YUV420P;
       video_codec_ctx->rc_max_rate = 0;
       video_codec_ctx->rc_buffer_size = 0;
       video_codec_ctx->gop_size = 12;
       video_codec_ctx->max_b_frames = 0;
       video_codec_ctx->slices = 8;
       video_codec_ctx->b_frame_strategy = 1;
       video_codec_ctx->coder_type = 0;
       video_codec_ctx->me_cmp = 1;
       video_codec_ctx->me_range = 16;
       video_codec_ctx->qmin = 10;
       video_codec_ctx->qmax = 51;
       video_codec_ctx->keyint_min = 25;
       video_codec_ctx->refs = 3;
       video_codec_ctx->trellis = 0;
       video_codec_ctx->scenechange_threshold = 40;
       video_codec_ctx->flags |= CODEC_FLAG_LOOP_FILTER;
       video_codec_ctx->me_method = ME_HEX;
       video_codec_ctx->me_subpel_quality = 6;
       video_codec_ctx->i_quant_factor = 0.71;
       video_codec_ctx->qcompress = 0.6;
       video_codec_ctx->max_qdiff = 4;
       video_codec_ctx->time_base.den = 10;
       video_codec_ctx->time_base.num = 1;
       video_codec_ctx->bit_rate = 3200 * 1000;
       video_codec_ctx->bit_rate_tolerance = 0;
       video_codec_ctx->flags2 |= 0x00000100;

       fmt_context->bit_rate = 4000 * 1000;

       av_opt_set(video_codec_ctx, "partitions", "i8x8,i4x4,p8x8,b8x8", 0);
       av_opt_set_int(video_codec_ctx, "direct-pred", 1, 0);
       av_opt_set_int(video_codec_ctx, "rc-lookahead", 0, 0);
       av_opt_set_int(video_codec_ctx, "fast-pskip", 1, 0);
       av_opt_set_int(video_codec_ctx, "mixed-refs", 1, 0);
       av_opt_set_int(video_codec_ctx, "8x8dct", 0, 0);
       av_opt_set_int(video_codec_ctx, "weightb", 0, 0);

       if (fmt_context->oformat->flags &amp; AVFMT_GLOBALHEADER)
           video_codec_ctx->flags |= CODEC_FLAG_GLOBAL_HEADER;

       LOGI("Opening video codec");
       AVDictionary *vopts = NULL;
       av_dict_set(&amp;vopts, "profile", "main", 0);
       //av_dict_set(&amp;vopts, "vprofile", "main", 0);
       av_dict_set(&amp;vopts, "rc-lookahead", 0, 0);
       av_dict_set(&amp;vopts, "tune", "film", 0);
       av_dict_set(&amp;vopts, "preset", "ultrafast", 0);
       av_opt_set(video_codec_ctx->priv_data, "tune", "film", 0);
       av_opt_set(video_codec_ctx->priv_data, "preset", "ultrafast", 0);
       av_opt_set(video_codec_ctx->priv_data, "tune", "film", 0);
       int open_res = avcodec_open2(video_codec_ctx, video_codec, &amp;vopts);
       if (open_res &lt; 0) {
           LOGI("Error opening video codec: %i", open_res);
           return JNI_FALSE;   // leak!
       }

       // Open Audio Codec.
       // ======================

       if (enable_audio) {
           AudioBuffer_Clear();
           audio_sample_rate = audio_sample_rate_param;
           AVCodec *audio_codec = avcodec_find_encoder(AV_CODEC_ID_AAC);
           if (!audio_codec) {
               LOGI("Did not find the audio codec");
               return JNI_FALSE;  // leak!
           } else {
               LOGI("Audio codec found!");
           }
           AVCodecContext *audio_codec_ctx = audio_stream->codec;
           audio_codec_ctx->codec_id = audio_codec->id;
           audio_codec_ctx->codec_type = AVMEDIA_TYPE_AUDIO;
           audio_codec_ctx->bit_rate = 128000;
           audio_codec_ctx->bit_rate_tolerance = 16000;
           audio_codec_ctx->channels = 1;
           audio_codec_ctx->profile = FF_PROFILE_AAC_LOW;
           audio_codec_ctx->sample_fmt = AV_SAMPLE_FMT_FLT;
           audio_codec_ctx->sample_rate = 44100;

           LOGI("Opening audio codec");
           AVDictionary *opts = NULL;
           av_dict_set(&amp;opts, "strict", "experimental", 0);
           open_res = avcodec_open2(audio_codec_ctx, audio_codec, &amp;opts);
           LOGI("audio frame size: %i", audio_codec_ctx->frame_size);

           if (open_res &lt; 0) {
               LOGI("Error opening audio codec: %i", open_res);
               return JNI_FALSE;   // leak!
           }
       }

       const jbyte *url = (*env)->GetStringUTFChars(env, rtmp_url, NULL);

       // Point to an output file
       if (!(ofmt->flags &amp; AVFMT_NOFILE)) {
           if (avio_open(&amp;fmt_context->pb, url, URL_WRONLY) &lt; 0) {
               LOGI("ERROR: Could not open file %s", url);
               return JNI_FALSE;  // leak!
           }
       }
       (*env)->ReleaseStringUTFChars(env, rtmp_url, url);

       LOGI("Writing output header.");
       // Write file header
       if (avformat_write_header(fmt_context, NULL) != 0) {
           LOGI("ERROR: av_write_header failed");
           return JNI_FALSE;
       }

       pts = 0;
       last_audio_pts = 0;
       audio_samples_written = 0;

       // Initialize buffers for UV format conversion
       int frame_size = video_codec_ctx->width * video_codec_ctx->height;
       u_buf = (unsigned char *) av_malloc(frame_size / 4);
       v_buf = (unsigned char *) av_malloc(frame_size / 4);

       LOGI("ffmpeg encoding init done");
       return JNI_TRUE;
    }

    JNIEXPORT void JNICALL
    Java_com_example_venrto_ffmpegtest_Ffmpeg_shutdown(JNIEnv
                                                        *env,
                                                        jobject thiz
    ) {
       av_write_trailer(fmt_context);
       avio_close(fmt_context
                          ->pb);
       avcodec_close(video_stream
                             ->codec);
       if (enable_audio) {
           avcodec_close(audio_stream
                                 ->codec);
       }
       av_free(fmt_context);
       av_free(u_buf);
       av_free(v_buf);

       fmt_context = NULL;
       u_buf = NULL;
       v_buf = NULL;
    }

    JNIEXPORT jintJNICALL
    Java_com_example_venrto_ffmpegtest_Ffmpeg_encodeVideoFrame(JNIEnv
                                                                *env,
                                                                jobject thiz,
                                                                jbyteArray
                                                                yuv_image) {
       int yuv_length = (*env)->GetArrayLength(env, yuv_image);
       unsigned char *yuv_data = (*env)->GetByteArrayElements(env, yuv_image, 0);

       AVCodecContext *video_codec_ctx = video_stream->codec;
    //LOGI("Yuv size: %i w: %i h: %i", yuv_length, video_codec_ctx->width, video_codec_ctx->height);

       int frame_size = video_codec_ctx->width * video_codec_ctx->height;

       const unsigned char *uv = yuv_data + frame_size;

    // Convert YUV from NV12 to I420. Y channel is the same so we don't touch it,
    // we just have to deinterleave UV.
       for (
               int i = 0;
               i &lt; frame_size / 4; i++) {
           v_buf[i] = uv[i * 2];
           u_buf[i] = uv[i * 2 + 1];
       }

       AVFrame source;
       memset(&amp;source, 0, sizeof(AVFrame));
       source.data[0] =
               yuv_data;
       source.data[1] =
               u_buf;
       source.data[2] =
               v_buf;
       source.linesize[0] = video_codec_ctx->
               width;
       source.linesize[1] = video_codec_ctx->width / 2;
       source.linesize[2] = video_codec_ctx->width / 2;

    // only for bitrate regulation. irrelevant for sync.
       source.
               pts = pts;
       pts++;

       int out_length = frame_size + (frame_size / 2);
       unsigned char *out = (unsigned char *) av_malloc(out_length);
       int compressed_length = avcodec_encode_video(video_codec_ctx, out, out_length, &amp;source);

       (*env)->
               ReleaseByteArrayElements(env, yuv_image, yuv_data,
                                        0);

    // Write to file too
       if (compressed_length > 0) {
           AVPacket pkt;
           av_init_packet(&amp;pkt);
           pkt.
                   pts = last_audio_pts;
           if (video_codec_ctx->coded_frame &amp;&amp; video_codec_ctx->coded_frame->key_frame) {
               pkt.flags |= 0x0001;
           }
           pkt.
                   stream_index = video_stream->index;
           pkt.
                   data = out;
           pkt.
                   size = compressed_length;
           if (
                   av_interleaved_write_frame(fmt_context,
                                              &amp;pkt) != 0) {
               LOGI("Error writing video frame");
           }
       } else {
           LOGI("??? compressed_length &lt;= 0");
       }

       last_audio_pts++;

       av_free(out);
       return
               compressed_length;
    }

    JNIEXPORT jintJNICALL
    Java_com_example_venrto_ffmpegtest_Ffmpeg_encodeAudioFrame(JNIEnv
                                                                *env,
                                                                jobject thiz,
                                                                jshortArray
                                                                audio_data,
                                                                jint length
    ) {
       if (!enable_audio) {
           return 0;
       }

       short *audio = (*env)->GetShortArrayElements(env, audio_data, 0);
    //LOGI("java audio buffer size: %i", length);

       AVCodecContext *audio_codec_ctx = audio_stream->codec;

       unsigned char *out = av_malloc(128000);

       AudioBuffer_Push(audio, length
       );

       int total_compressed = 0;
       while (

               AudioBuffer_Size()

               >= audio_codec_ctx->frame_size) {
           AVPacket pkt;
           av_init_packet(&amp;pkt);

           int compressed_length = avcodec_encode_audio(audio_codec_ctx, out, 128000,
                                                        AudioBuffer_Get());

           total_compressed +=
                   compressed_length;
           audio_samples_written += audio_codec_ctx->
                   frame_size;

           int new_pts = (audio_samples_written * 1000) / audio_sample_rate;
           if (compressed_length > 0) {
               pkt.
                       size = compressed_length;
               pkt.
                       pts = new_pts;
               last_audio_pts = new_pts;
    //LOGI("audio_samples_written: %i  comp_length: %i   pts: %i", (int)audio_samples_written, (int)compressed_length, (int)new_pts);
               pkt.flags |= 0x0001;
               pkt.
                       stream_index = audio_stream->index;
               pkt.
                       data = out;
               if (
                       av_interleaved_write_frame(fmt_context,
                                                  &amp;pkt) != 0) {
                   LOGI("Error writing audio frame");
               }
           }
           AudioBuffer_Pop(audio_codec_ctx
                                   ->frame_size);
       }

       (*env)->
               ReleaseShortArrayElements(env, audio_data, audio,
                                         0);

       av_free(out);
       return
               total_compressed;
    }

    this an example for a header file which i have an error include

    #include "libavutil/samplefmt.h"
    #include "libavutil/avutil.h"
    #include "libavutil/cpu.h"
    #include "libavutil/dict.h"
    #include "libavutil/log.h"
    #include "libavutil/pixfmt.h"
    #include "libavutil/rational.h"

    #include "libavutil/version.h"

    in the libavcodec/avcodec.h

    This code based in this example :
    https://github.com/youtube/yt-watchme