Recherche avancée

Médias (91)

Autres articles (68)

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

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

  • Image to MPEG on Linux works, same code on Android = green video

    5 avril 2018, par JScoobyCed

    EDIT
    I have check the execution and found that the error is not (yet) at the swscale point. My current issue is that the JPG image is not found :
    No such file or directory
    when doing the avformat_open_input(&pFormatCtx, imageFileName, NULL, NULL);
    Before you tell me I need to register anything, I can tell I already did (I updated the code below).
    I also added the Android permission to access the external storage (I don’t think it is related to Android since I can already write to the /mnt/sdcard/ where the image is also located)
    END EDIT

    I have been through several tutorials (including the few posted from SO, i.e. http://dranger.com/ffmpeg/, how to compile ffmpeg for Android...,been through dolphin-player source code). Here is what I have :
    . Compiled ffmpeg for android
    . Ran basic tutorials using NDK to create a dummy video on my android device
    . been able to generate a MPEG2 video from images on Ubuntu using a modified version of dummy video code above and a lot of Googling
    . running the new code on Android device gives a green screen video (duration 1 sec whatever the number of frames I encode)

    I saw another post about iPhone in a similar situation that mentioned the ARM processor optimization could be the culprit. I tried a few ldextra-flags (-arch armv7-a and similar) to no success.

    I include at the end the code that loads the image. Is there something different to do on Android than on linux ? Is my ffmpeg build not correct for Android video encoding ?

    void copyFrame(AVCodecContext *destContext, AVFrame* dest,
               AVCodecContext *srcContext, AVFrame* source) {
    struct SwsContext *swsContext;
    swsContext = sws_getContext(srcContext->width, srcContext->height, srcContext->pix_fmt,
                   destContext->width, destContext->height, destContext->pix_fmt,
                   SWS_FAST_BILINEAR, NULL, NULL, NULL);
    sws_scale(swsContext, source->data, source->linesize, 0, srcContext->height, dest->data, dest->linesize);
    sws_freeContext(swsContext);
    }

    int loadFromFile(const char* imageFileName, AVFrame* realPicture, AVCodecContext* videoContext) {
    AVFormatContext *pFormatCtx = NULL;
    avcodec_register_all();
    av_register_all();

    int ret = avformat_open_input(&pFormatCtx, imageFileName, NULL, NULL);
    if (ret != 0) {
       // ERROR hapening here
       // Can't open image file. Use strerror(AVERROR(ret))) for details
       return ERR_CANNOT_OPEN_IMAGE;
    }

    AVCodecContext *pCodecCtx;

    pCodecCtx = pFormatCtx->streams[0]->codec;
    pCodecCtx->width = W_VIDEO;
    pCodecCtx->height = H_VIDEO;
    pCodecCtx->pix_fmt = PIX_FMT_YUV420P;

    // Find the decoder for the video stream
    AVCodec *pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
    if (!pCodec) {
       // Codec not found
       return ERR_CODEC_NOT_FOUND;
    }

    // Open codec
    if (avcodec_open(pCodecCtx, pCodec) < 0) {
       // Could not open codec
       return ERR_CANNOT_OPEN_CODEC;
    }

    //
    AVFrame *pFrame;

    pFrame = avcodec_alloc_frame();

    if (!pFrame) {
       // Can't allocate memory for AVFrame
       return ERR_CANNOT_ALLOC_MEM;
    }

    int frameFinished;
    int numBytes;

    // Determine required buffer size and allocate buffer
    numBytes = avpicture_get_size(PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
    uint8_t *buffer = (uint8_t *) av_malloc(numBytes * sizeof (uint8_t));

    avpicture_fill((AVPicture *) pFrame, buffer, PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
    AVPacket packet;
    int res = 0;
    while (av_read_frame(pFormatCtx, &packet) >= 0) {
       if (packet.stream_index != 0)
           continue;

       ret = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
       if (ret > 0) {
           // now, load the useful info into realPicture
           copyFrame(videoContext, realPicture, pCodecCtx, pFrame);
           // Free the packet that was allocated by av_read_frame
           av_free_packet(&packet);
           return 0;
       } else {
           // Error decoding frame. Use strerror(AVERROR(ret))) for details
           res = ERR_DECODE_FRAME;
       }
    }
    av_free(pFrame);

    // close codec
    avcodec_close(pCodecCtx);

    // Close the image file
    av_close_input_file(pFormatCtx);

    return res;
    }

    Some ./configure options :
    --extra-cflags="-O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 -mfloat-abi=softfp -mfpu=vfp -marm -march=armv7-a -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"

    --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog"

    --arch=armv7-a --enable-armv5te --enable-armv6 --enable-armvfp --enable-memalign-hack

  • Ffmpeg not compiling

    25 mai 2018, par Robin Betka

    I’m trying to compile ffmpeg 4.0 for Android (using Ubuntu 64 bit) but I can not get it to work.
    I was able to compile it for Linux itself fairly fast, but now struggling using the NDK. I’m unexperienced with this so I might have some major flaw somewhere. All paths and files exist. Github tutorials are extremely outdated and don’t work as well for me with different errors.

    Getting following error :

    In file included from ./libavformat/internal.h:24:0,
                from libavdevice/alldevices.c:23:
    /home/lit/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-
    4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-
    androideabi/4.9.x/include/stdint.h:9:26: fatal error: stdint.h: No such file
    or directory
    # include_next
                         ^
    compilation terminated.
    ffbuild/common.mak:60: recipe for target 'libavdevice/alldevices.o' failed
    make: *** [libavdevice/alldevices.o] Error 1

    My build script :

    SYSROOT=/home/lit/Android/Sdk/ndk-bundle/platforms/android-14/arch-arm/
    TOOLCHAIN=/home/lit/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-
    4.9/prebuilt/linux-x86_64

    cd ffmpeg/ffmpeg && \
    PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"
    ./configure \
    --prefix="$HOME/ffmpeg_build" \
    --pkg-config-flags="--static" \
    --extra-cflags="-O3 -Wall -pipe -ffast-math -fstrict-aliasing -Werror=strict- aliasing -Wno-psabi -Wa,--noexecstack -DANDROID -DNDEBUG-march=armv5te -mtune=arm9tdmi -msoft-float"\
    --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
    --bindir="$HOME/bin" \
    --arch=arm \
    --target-os=linux \
    --enable-cross-compile \
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    --cpu=armv5te \
    --sysroot=$SYSROOT \
    --enable-gpl \
    --enable-small \
    --enable-nonfree && \

    PATH="$HOME/bin:$PATH" make && \
    make -j2 && \
    make install && \
    hash -r

    Thank you for your help.

  • ffmpeg first segment does not have audio

    5 mars 2018, par Giorgi Peikrishvili

    I’m recording http stream using ffmpeg. Here is my command :

    ffmpeg -i https://tv-tbs-silk-front 1.adjara.com/4w/rustavi2hd/index.m3u8\?token\=376d9f864d81c7f85410ac5d3d0bde3dd6574daf-Hog86dAubE-1522939917-1520175117 -c copy -map 0 -bsf:a aac_adtstoasc -flags +global_header -f segment -segment_time 10 -force_key_frames 10 -segment_format_options movflags=+faststart -reset_timestamps 1 -strftime 1 %Y-%m-%d_%H-%M-%S.mov

    It makes segments as should be, but the only first segment does not have sound, others does.
    Any ideas about that ?

    Update as suggested in comments :
    Here is full output

    ffmpeg -i  -c copy -map 0 -g 10 -bsf:a aac_adtstoasc -flags
    +global_header -f segment -segment_time 10 -force_key_frames 10 -
    segment_format_options movflags=+faststart -reset_timestamps 1 -
    strftime 1 %Y-%m-%d_%H-%M-%S.mov
    ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
    built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM
    3.6.0svn) configuration: --prefix=/Users/Cipusha/anaconda2
    --disable-doc --enable-shared --enable-static --extra-cflags='-Wall -g
    -m64 -pipe -O3 -march=x86-64 -fPIC -I/Users/Cipusha/anaconda2/include'
    --extra-cxxflags='=-Wall -g -m64 -pipe -O3 -march=x86-64 -fPIC' --
    extra-libs='-L/Users/Cipusha/anaconda2/lib -lz' --enable-pic --enable-
    gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --
    enable-libx264

     libavutil      55. 34.101 / 55. 34.101
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.101 / 57. 56.101
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libavresample   3.  1.  0 /  3.  1.  0
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100

    Input #0, hls,applehttp, from 'https://tv-tbs-silk-front-
    1.adjara.com/4w/rustavi2hd/index.m3u8?
    token=376d9f864d81c7f85410ac5d3d0bde3dd6574daf-Hog86dAubE-1522939917-
    1520175117':
    Duration: N/A, start: 58671.490378, bitrate: N/A
     Program 0
       Metadata:
         variant_bitrate : 2953271
       Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz,
    stereo, fltp
    Metadata:
         variant_bitrate : 2953271
       Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p,
    720x576 [SAR 1:1 DAR 5:4], 25 fps, 25 tbr, 90k tbn, 50 tbc
       Metadata:
          variant_bitrate : 2953271
    Output #0, segment, to '%Y-%m-%d_%H-%M-%S.mov':
     Metadata:
       encoder         : Lavf57.56.101
       Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz,
    stereo
       Metadata:
         variant_bitrate : 2953271
       Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p,
    720x576 [SAR 1:1 DAR 5:4], q=2-31, 25 fps, 25 tbr, 12800 tbn, 25 tbc
       Metadata:
         variant_bitrate : 2953271
    Stream mapping:
         Stream #0:0 -> #0:0 (copy)
         Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [mov @ 0x7f9c97018e00] Starting second pass: moving the moov atom to the beginning of the file
    [mov @ 0x7f9c96803200] Starting second pass: moving the moov atom to the beginning of the file
    [mov @ 0x7f9c98000000] Starting second pass: moving the moov atom to the beginning of the file
    frame=  581 fps= 38 q=-1.0 Lsize=N/A time=00:00:23.20 bitrate=N/A speed= 1.5x

    Thank you very much