Recherche avancée

Médias (91)

Autres articles (89)

  • 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 (...)

  • Emballe Médias : Mettre en ligne simplement des documents

    29 octobre 2010, par

    Le plugin emballe médias a été développé principalement pour la distribution mediaSPIP mais est également utilisé dans d’autres projets proches comme géodiversité par exemple. Plugins nécessaires et compatibles
    Pour fonctionner ce plugin nécessite que d’autres plugins soient installés : CFG Saisies SPIP Bonux Diogène swfupload jqueryui
    D’autres plugins peuvent être utilisés en complément afin d’améliorer ses capacités : Ancres douces Légendes photo_infos spipmotion (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (8723)

  • FFmpeg on android is crashing in avcodec_decode_video2 function

    6 juin 2015, par Matt Wolfe

    FFmpeg is crashing on : libavcodec/utils.c avcodec_decode_video2 around line 2400

    ret = avctx->codec->decode(avctx, picture, got_picture_ptr, &tmp);

    So I’ve compiled ffmpeg on android using the following configure script (based from here ) :

    prefix=${src_root}/ffmpeg/android/arm

    addi_cflags="-marm -Os -fpic"
    addi_ldflags=""

    ./configure \
    --prefix=${prefix} \
    --target-os=linux \
    --arch=arm \
    --enable-shared \
    --disable-doc \
    --disable-programs \
    --disable-symver \
    --cross-prefix=${TOOLCHAIN}/bin/arm-linux-androideabi- \
    --enable-cross-compile \
    --enable-decoder=aac \
    --enable-decoder=mpeg4 \
    --enable-decoder=h263 \
    --enable-decoder=flv \
    --enable-decoder=mpegvideo \
    --enable-decoder=mpeg2video \
    --sysroot=${SYSROOT} \
    --extra-cflags="${addi_cflags}" \
    --pkg-config=$(which pkg-config) >> ${build_log} 2>&1 || die "Couldn't configure ffmpeg"

    The *.so files get copied over into my projects which I reference from my Android.mk script :

    LOCAL_PATH := $(call my-dir)
    FFMPEG_PATH=/path/to/android-ffmpeg-with-rtmp/build/dist

    include $(CLEAR_VARS)
    LOCAL_MODULE := libavcodec
    LOCAL_SRC_FILES :=$(FFMPEG_PATH)/lib/libavcodec-56.so
    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)
    LOCAL_MODULE := libavdevice
    LOCAL_SRC_FILES :=$(FFMPEG_PATH)/lib/libavdevice-56.so
    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)
    LOCAL_MODULE := libavfilter
    LOCAL_SRC_FILES :=$(FFMPEG_PATH)/lib/libavfilter-5.so
    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)
    LOCAL_MODULE := libavformat
    LOCAL_SRC_FILES :=$(FFMPEG_PATH)/lib/libavformat-56.so
    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)
    LOCAL_MODULE := libavutil
    LOCAL_SRC_FILES :=$(FFMPEG_PATH)/lib/libavutil-54.so
    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)
    LOCAL_MODULE := libswresample
    LOCAL_SRC_FILES :=$(FFMPEG_PATH)/lib/libswresample-1.so
    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)
    LOCAL_MODULE := libswscale
    LOCAL_SRC_FILES :=$(FFMPEG_PATH)/lib/libswscale-3.so
    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)
    LOCAL_LDLIBS := -llog
    LOCAL_C_INCLUDES := $(FFMPEG_PATH)/include
    #LOCAL_PRELINK_MODULE := false
    LOCAL_MODULE    := axonffmpeg
    LOCAL_SRC_FILES := libffmpeg.c
    LOCAL_CFLAGS := -g
    LOCAL_SHARED_LIBRARIES := libavcodec libavdevice libavfilter libavformat libavutil libswresample libswscale
    include $(BUILD_SHARED_LIBRARY)

    I’m building a little wrapper to decode frames (mpeg4 video,part 2 simple profile) that come from an external camera :

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

    #include <libavutil></libavutil>opt.h>
    #include <libavcodec></libavcodec>avcodec.h>
    #include <libavutil></libavutil>channel_layout.h>
    #include <libavutil></libavutil>common.h>
    #include <libavutil></libavutil>imgutils.h>
    #include <libavutil></libavutil>mathematics.h>
    #include <libavutil></libavutil>samplefmt.h>

    #define DEBUG_TAG "LibFFMpeg:NDK"

    AVCodec *codec;
    AVFrame *current_frame;
    AVCodecContext *context;

    int resWidth, resHeight, bitRate;

    void my_log_callback(void *ptr, int level, const char *fmt, va_list vargs);

    jint Java_com_mycompany_axonv2_LibFFMpeg_initDecoder(JNIEnv * env, jobject this,
     jint _resWidth, jint _resHeight, jint _bitRate)
    {
        __android_log_print(ANDROID_LOG_DEBUG, DEBUG_TAG, "initDecoder called");

       int len;

       resWidth = _resWidth;
       resHeight = _resHeight;
       bitRate = _bitRate;
       av_log_set_callback(my_log_callback);
       av_log_set_level(AV_LOG_VERBOSE);
       avcodec_register_all();
       codec = avcodec_find_encoder(AV_CODEC_ID_MPEG4);
       if (!codec) {
         __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG, "codec %d not found", AV_CODEC_ID_MPEG4);
         return -1;
       }
       context = avcodec_alloc_context3(codec);    
       if (!context) {
         __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,  "Could not allocate codec context");
         return -1;
       }

       context->width = resWidth;
       context->height = resHeight;
       context->bit_rate = bitRate;
       context->pix_fmt = AV_PIX_FMT_YUV420P;
       context->time_base.den = 6;
       context->time_base.num = 1;
       int openRet = avcodec_open2(context, codec, NULL);
       if (openRet &lt; 0) {
         __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,  "Could not open codec, error:%d", openRet);
         return -1;
       }
       current_frame = av_frame_alloc();    
       if (!current_frame) {
         __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,  "Could not allocate video frame");
         return -1;
       }    
       return 0;    
    }


    void my_log_callback(void *ptr, int level, const char *fmt, va_list vargs) {

     __android_log_print (level, DEBUG_TAG, fmt, vargs);

    }

    jint Java_com_mycompany_axonv2_LibFFMpeg_queueFrameForDecoding(JNIEnv * env, jobject this,
     jlong pts, jbyteArray jBuffer)
    {

       __android_log_print(ANDROID_LOG_DEBUG, DEBUG_TAG, "queueFrameForDecoding called");

       AVPacket avpkt;
       av_init_packet(&amp;avpkt);
       int buffer_len = (*env)->GetArrayLength(env, jBuffer);
       uint8_t* buffer = (uint8_t *) (*env)->GetByteArrayElements(env, jBuffer,0);
       int got_frame = 0;
       __android_log_print(ANDROID_LOG_DEBUG, DEBUG_TAG, "copied %d bytes into uint8_t* buffer", buffer_len);

       av_packet_from_data(&amp;avpkt, buffer, buffer_len);
       __android_log_print(ANDROID_LOG_DEBUG, DEBUG_TAG, "av_packet_from_data called");

       avpkt.pts = pts;
       int ret = avcodec_decode_video2(context, current_frame, &amp;got_frame, &amp;avpkt);

       __android_log_print(ANDROID_LOG_DEBUG, DEBUG_TAG, "avcodec_decode_video2 returned %d" , ret);

       (*env)->ReleaseByteArrayElements(env, jBuffer, (jbyte*) buffer, 0);
       __android_log_print(ANDROID_LOG_DEBUG, DEBUG_TAG, "ReleaseByteArrayElements()");

       return 0;
    }

    Alright so the init function above works fine and the queueFrameForDecoding works up until the avcodec_decode_video2 function. I’m not expecting it to work just quite yet however as I’ve been logging output as to where we get in that function, I’ve found that there is a call (in avutil.c) :
    (around line 2400 in the latest code)

    avcodec_decode_video2(...) {
      ....
           ret = avctx->codec->decode(avctx, picture, got_picture_ptr, &amp;tmp);

    init runs fine and finds the codec and all that. Everything works great up until the avcodec_decode_video2 call :

    *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'samsung/klteuc/klteatt:4.4.2/KOT49H/G900AUCU2ANG3:user/release-keys'
    Revision: '14'
    pid: 19355, tid: 22584, name: BluetoothReadTh  >>> com.mycompany.axonv2 &lt;&lt;&lt;
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
    r0 79308400  r1 79491710  r2 7b0b4a70  r3 7b0b49e8
    r4 79308400  r5 79491710  r6 00000000  r7 7b0b49e8
    r8 7b0b4a70  r9 7b0b4a80  sl 795106d8  fp 00000000
    ip 00000000  sp 7b0b49b8  lr 7ba05c18  pc 00000000  cpsr 600f0010
    d0  206c616768616c62  d1  6564206365646f63
    d2  756f722065646f63  d3  20736920656e6974
    d4  0b0a01000a0a0a0b  d5  0a630a01000a0a0a
    d6  0a630a011a00f80a  d7  0b130a011a00f90a
    d8  0000000000000000  d9  0000000000000000
    d10 0000000000000000  d11 0000000000000000
    d12 0000000000000000  d13 0000000000000000
    d14 0000000000000000  d15 0000000000000000
    d16 6369705f746f6720  d17 7274705f65727574
    d18 8000000000000000  d19 00000b9e42bd5730
    d20 0000000000000000  d21 0000000000000000
    d22 7b4fd10400000000  d23 773b894877483b68
    d24 0000000000000000  d25 3fc2f112df3e5244
    d26 40026bb1bbb55516  d27 0000000000000000
    d28 0000000000000000  d29 0000000000000000
    d30 0000000000000000  d31 0000000000000000
    scr 60000010
    backtrace:
    #00  pc 00000000  <unknown>
    #01  pc 00635c14  /data/app-lib/com.mycompany.axonv2-6/libavcodec-56.so (avcodec_decode_video2+1128)
    </unknown>

    I don’t understand why it’s crashing when trying to call the decode function. I’ve looked into the codec function pointer list and this should be calling ff_h263_decode_frame (source, libavcodec/mpeg4videodec.c) :

    AVCodec ff_mpeg4_decoder = {
       .name                  = "mpeg4",
       .long_name             = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
       .type                  = AVMEDIA_TYPE_VIDEO,
       .id                    = AV_CODEC_ID_MPEG4,
       .priv_data_size        = sizeof(Mpeg4DecContext),
       .init                  = decode_init,
       .close                 = ff_h263_decode_end,
       .decode                = ff_h263_decode_frame,
       .capabilities          = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
                                CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
                                CODEC_CAP_FRAME_THREADS,
       .flush                 = ff_mpeg_flush,
       .max_lowres            = 3,
       .pix_fmts              = ff_h263_hwaccel_pixfmt_list_420,
       .profiles              = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles),
       .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg4_update_thread_context),
       .priv_class = &amp;mpeg4_class,
    };

    I know that the ff_h263_decode_frame function isn’t being called because I added logging to it and none of that gets printed.
    However, if I just call ff_h263_decode_frame directly from avcodec_decode_video2 then my logging gets output. I don’t want to call this function directly though and would rather get the ffmpeg framework working correctly. Is there something wrong with how I’ve configured ffmpeg ? I have added mpegvideo, mpeg2video, flv, h263, to the configure script but none have them have helped (they should be included automatically by —enable-decoder=mpeg4).

    Any help would be greatly appreciated.

  • Files created with "ffmpeg hevc_nvenc" do not play on TV. (with video codec SDK 9.1 of nvidia)

    29 janvier 2020, par Dashhh

    Problem

    • Files created with hevc_nvenc do not play on TV. (samsung smart tv, model unknown)
      Related to my ffmpeg build is below.

    FFmpeg build conf

    $ ffmpeg -buildconf
       --enable-cuda
       --enable-cuvid
       --enable-nvenc
       --enable-nonfree
       --enable-libnpp
       --extra-cflags=-I/path/cuda/include
       --extra-ldflags=-L/path/cuda/lib64
       --prefix=/prefix/ffmpeg_build
       --pkg-config-flags=--static
       --extra-libs='-lpthread -lm'
       --extra-cflags=-I/prefix/ffmpeg_build/include
       --extra-ldflags=-L/prefix/ffmpeg_build/lib
       --enable-gpl
       --enable-nonfree
       --enable-version3
       --disable-stripping
       --enable-avisynth
       --enable-libass
       --enable-libfontconfig
       --enable-libfreetype
       --enable-libfribidi
       --enable-libgme
       --enable-libgsm
       --enable-librubberband
       --enable-libshine
       --enable-libsnappy
       --enable-libssh
       --enable-libtwolame
       --enable-libwavpack
       --enable-libzvbi
       --enable-openal
       --enable-sdl2
       --enable-libdrm
       --enable-frei0r
       --enable-ladspa
       --enable-libpulse
       --enable-libsoxr
       --enable-libspeex
       --enable-avfilter
       --enable-postproc
       --enable-pthreads
       --enable-libfdk-aac
       --enable-libmp3lame
       --enable-libopus
       --enable-libtheora
       --enable-libvorbis
       --enable-libvpx
       --enable-libx264
       --enable-libx265
       --disable-ffplay
       --enable-libopenjpeg
       --enable-libwebp
       --enable-libxvid
       --enable-libvidstab
       --enable-libopenh264
       --enable-zlib
       --enable-openssl

    ffmpeg Command

    • Command about FFmpeg encoding
    ffmpeg -ss 1800 -vsync 0 -hwaccel cuvid -hwaccel_device 0 \
    -c:v h264_cuvid -i /data/input.mp4 -t 10 \
    -filter_complex "\
    [0:v]hwdownload,format=nv12,format=yuv420p,\
    scale=iw*2:ih*2" -gpu 0 -c:v hevc_nvenc -pix_fmt yuv444p16le -preset slow -rc cbr_hq -b:v 5000k -maxrate 7000k -bufsize 1000k -acodec aac -ac 2 -dts_delta_threshold 1000 -ab 128k -flags global_header ./makevideo_nvenc_hevc.mp4

    Full log about This Command - check this full log

    The reason for adding "-color_ " in the command is as follows.

    • HDR video after creating bt2020 + smpte2084 video using nvidia hardware accelerator. (I’m studying to make HDR videos. I’m not sure if this is right.)

    How can I make a video using ffmpeg hevc_nvenc and have it play on TV ?


    Things i’ve done

    Here’s what I’ve researched about why it doesn’t work.
    - The header information is not properly included in the resulting video file. So I used a program called nvhsp to add SEI and VUI information inside the video. See below for the commands and logs used.

    nvhsp is open source for writing VUI and SEI bitstrings in raw video. nvhsp link

    # make rawvideo for nvhsp
    $  ffmpeg -vsync 0 -hwaccel cuvid -hwaccel_device 0 -c:v h264_cuvid \
    -i /data/input.mp4 -t 10 \
    -filter_complex "[0:v]hwdownload,format=nv12,\
    format=yuv420p,scale=iw*2:ih*2" \
    -gpu 0 -c:v hevc_nvenc -f rawvideo output_for_nvhsp.265

    # use nvhsp
    $ python nvhsp.py ./output_for_nvhsp.265 -colorprim bt2020 \
    -transfer smpte-st-2084 -colormatrix bt2020nc \
    -maxcll "1000,300" -videoformat ntsc -full_range tv \
    -masterdisplay "G (13250,34500) B (7500,3000 ) R (34000,16000) WP (15635,16450) L (10000000,1)" \
    ./after_nvhsp_proc_output.265

    Parsing the infile:

    ==========================

    Prepending SEI data
    Starting new SEI NALu ...
    SEI message with MaxCLL = 1000 and MaxFall = 300 created in SEI NAL
    SEI message Mastering Display Data G (13250,34500) B (7500,3000) R (34000,16000) WP (15635,16450) L (10000000,1) created in SEI NAL
    Looking for SPS ......... [232, 22703552]
    SPS_Nals_addresses [232, 22703552]
    SPS NAL Size 488
    Starting reading SPS NAL contents
    Reading of SPS NAL finished. Read 448 of SPS NALu data.

    Making modified SPS NALu ...
    Made modified SPS NALu-OK
    New SEI prepended
    Writing new stream ...
    Progress: 100%
    =====================
    Done!

    File nvhsp_after_output.mp4 created.

    # after process
    $ ffmpeg -y -f rawvideo -r 25 -s 3840x2160 -pix_fmt yuv444p16le -color_primaries bt2020 -color_trc smpte2084  -colorspace bt2020nc -color_range tv -i ./1/after_nvhsp_proc_output.265 -vcodec copy  ./1/result.mp4 -hide_banner

    Truncating packet of size 49766400 to 3260044
    [rawvideo @ 0x40a6400] Estimating duration from bitrate, this may be inaccurate
    Input #0, rawvideo, from './1/nvhsp_after_output.265':
     Duration: N/A, start: 0.000000, bitrate: 9953280 kb/s
       Stream #0:0: Video: rawvideo (Y3[0][16] / 0x10003359), yuv444p16le(tv, bt2020nc/bt2020/smpte2084), 3840x2160, 9953280 kb/s, 25 tbr, 25 tbn, 25 tbc
    [mp4 @ 0x40b0440] Could not find tag for codec rawvideo in stream #0, codec not currently supported in container
    Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
       Last message repeated 1 times

    Goal

    • I want to generate matadata normally when encoding a video through hevc_nvenc.

    • I want to create a video through hevc_nvenc and play HDR Video on smart tv with 10bit color depth support.


    Additional

    • Is it normal for ffmpeg hevc_nvenc not to generate metadata in the resulting video file ? or is it a bug ?

    • Please refer to the image below. (*’알 수 없음’ meaning ’unknown’)

      • if you need more detail file info, check this Gist Link (by ffprobe)
        hevc_nvenc metadata
    • However, if you encode a file in libx265, the attribute information is entered correctly as shown below.

      • if you need more detail file info, check this Gist Link
        libx265 metadata

    However, when using hevc_nvenc, all information is missing.

    • i used option -show_streams -show_programs -show_format -show_data -of json -show_frames -show_log 56 at ffprobe
  • Revision 30966 : eviter le moche ’doctype_ecrire’ lors de l’upgrade

    17 août 2009, par fil@… — Log

    eviter le moche ’doctype_ecrire’ lors de l’upgrade