Recherche avancée

Médias (1)

Mot : - Tags -/belgique

Autres articles (61)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Les statuts des instances de mutualisation

    13 mars 2010, par

    Pour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
    Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...)

  • Configuration spécifique d’Apache

    4 février 2011, par

    Modules spécifiques
    Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
    Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
    Création d’un (...)

Sur d’autres sites (9680)

  • Allowing downloads of partial video files from Django

    18 janvier 2019, par DataVis

    I have a Django app that allows users to make/save ’clips’ of video files, that is keep timestamps of start and end times of video files to save in playlists. I would like users to be able to download clips (and playlists as well) they have saved.

    I have done quite a bit of research on the topic and have gotten ffmpeg working from my terminal to save partial clips (though I’ve struggled to figure out pathnames for using subprocess.call with ffmpeg), and I have also gotten moviepy working via the terminal to save partial clips.

    I’m struggling to figure out how to incorporate this into my Django app so that users can click a link and subsequently begin a download of a specific clip (or playlist). I believe I will want to use celery to avoid tying up the server but I’m not even to the point where I can offload a task as I can’t figure out how to :

    1. ’Clip’ the original, longer video file to make it shorter (do I need to make a local copy of a new file first ?).
    2. Send a response as a download to the user.

    Here is my models.py :

    class Match(models.Model):
       game_id = models.IntegerField(primary_key=True,
           validators=[MinValueValidator(1)],db_column="game_id")
       wide = models.FileField(upload_to='games/2018/',blank=True,null=True)

    class Playlist(models.Model):
           name = models.CharField(default='',null=True,blank=True,max_length=200)
           created_by = models.ForeignKey(User,related_name="playlists",on_delete=models.CASCADE)
           created =   models.DateTimeField(editable=False)
           modified =  models.DateTimeField()


           def save(self, *args, **kwargs):
               ''' On save, update timestamps '''
               if not self.id:
                   entries = Playlist.objects.order_by('-id')
                   try:
                       self.id = entries[0].id + 1
                   except IndexError:
                       # we don't have any PlaylistEntries yet, so we just start @ 0
                       self.id = 0
                   self.created = timezone.now()
               self.modified = timezone.now()

               return super(Playlist, self).save(*args, **kwargs)


       class Clip(models.Model):
           name =  models.CharField(default='',null=True,blank=True,max_length=200)
           game_id = models.ForeignKey(Match,related_name="clips",on_delete=models.CASCADE,
               db_column="game_id",null=True,blank=True)
           clipstart = models.IntegerField(null=True,blank=True)
           clipend = models.IntegerField(null=True,blank=True)
           playlist = models.ForeignKey(Playlist,related_name="clips",on_delete=models.CASCADE,
               db_column="playlist",null=True,blank=True)
           created_by = models.ForeignKey(User,related_name="clips",on_delete=models.CASCADE)
           created =   models.DateTimeField(editable=False)
           modified =  models.DateTimeField()
           duration = models.IntegerField(null=True,blank=True)

           def save(self, *args, **kwargs):
               ''' On save, update timestamps '''
               if not self.id:
                   entries = Clip.objects.order_by('-id')
                   try:
                       self.id = entries[0].id + 1
                   except IndexError:
                       # we don't have any PlaylistEntries yet, so we just start @ 0
                       self.id = 0
                   self.created = timezone.now()
               self.modified = timezone.now()
               self.duration = int(self.clipend) - int(self.clipstart)
               return super(Clip, self).save(*args, **kwargs)

    And views.py where I’m struggling (I’m not sure if I’m working with FileField properly etc) :

    from moviepy.editor import *
    def ClipDownload(request,pk,*args,**kwargs):

       this_clip = models.Clip.objects.filter(pk=pk)
       file_name = this_clip[0].game_id.wide

       p = VideoFileClip(file_name,audio=False).subclip(this_clip.clipstart,this_clip.clipend)

       response = HttpResponse(p, content_type='application/force-download')
       response['Content-Disposition'] = 'attachment; filename=%s' % this_clip.name
       response['Content-Length'] = os.path.getsize(file_name)
       return response

    The current code is not working, I’m getting the proper Clip but I’m not able to make a subclip of the FileField as I’m getting an attribute error :

    AttributeError: 'FieldFile' object has no attribute 'endswith'

    I would be very appreciative if someone can point me in the right direction to get the file downloading so I can move on to trying to incorporate it into celery ?

  • FFMPEG with Neon Optimization

    28 août 2021, par madadi

    I am decoding an h.264 video file on android using ffmpeg. The performace is very low. I would like to enable neon optimzation in ffmpeg to improve the performace. Inspite of adding the neon related commands in the config file, I don't see performance gain. Can someone tell me if I am going wrong anywhere ? My config file is as given below.

    



        function build_one_r6
{
make clean
./configure \
    --prefix=$PREFIX \
    --disable-shared \
    --enable-static \
    --enable-version3 \
    --disable-doc \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --disable-avdevice \
    --disable-avfilter \
    --disable-postproc \
    --enable-small \
    --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
    --enable-cross-compile \
    --target-os=linux \
    --extra-cflags="-I$PLATFORM/usr/include -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing $OPTIMIZE_CFLAGS" \
    --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
    --arch=arm \
    --disable-symver \
    --disable-debug \
    --disable-indevs \
    --disable-encoders \
    --disable-bsfs \
    --disable-filters \
$ADDITIONAL_CONFIGURE_FLAG || exit 1;
sed -i 's/HAVE_LRINT 0/HAVE_LRINT 1/g' config.h
sed -i 's/HAVE_LRINTF 0/HAVE_LRINTF 1/g' config.h
sed -i 's/HAVE_ROUND 0/HAVE_ROUND 1/g' config.h
sed -i 's/HAVE_ROUNDF 0/HAVE_ROUNDF 1/g' config.h
sed -i 's/HAVE_TRUNC 0/HAVE_TRUNC 1/g' config.h
sed -i 's/HAVE_TRUNCF 0/HAVE_TRUNCF 1/g' config.h
make  -j4 install || exit 1;
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o || exit 1;
$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -soname libffmpeg.so -shared -nostdlib  -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/lib/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog  --warn-once  --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a || exit 1;

}


#armv5te
CPU=armv5te
OPTIMIZE_CFLAGS="-marm -march=$CPU "
PREFIX=../../build/android/armeabi
ADDITIONAL_CONFIGURE_FLAG=
build_one_r6


#arm v7n
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8"
PREFIX=../../build/android/armeabi-v7a
ADDITIONAL_CONFIGURE_FLAG="--enable-neon --disable-armv5te --disable-armv6 --disable-armv6t2"
build_one_r6enter code here


    


  • How to compile FFmpeg for Android with clang in ubuntu18.04 ?

    31 juillet 2019, par user10959099

    I want to compile FFmpeg with clang as it’s more faster,but I don’t know how to do it in ubuntu.
    NDk version r16b ,ffmpeg version 4.1.

    I did it with gcc. here is my build script,and it works well.

    #!/bin/sh
    NDK=/home/gjy/ndk/android-ndk-r16b-linux-x86_64/android-ndk-r16b
    ANDROID_VERSION=19
    TOOLCHAIN_VERSION=4.9
    BUILD_PLATFORM=linux-x86_64
    ARCH=arm
    ANDROID_ARCH_ABI=armeabi
    HOST=arm-linux-androideabi
    CROSS=arm-linux-androideabi
    SYSROOT=${NDK}/platforms/android-${ANDROID_VERSION}/arch-${ARCH}/
    PREFIX=$(pwd)/android/${ANDROID_VERSION}/$ANDROID_ARCH_ABI
    TOOLCHAIN=${NDK}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
    CFLAGS="-Os -fpic -march=armv5te -isysroot $NDK/sysroot -I$NDK/sysroot/usr/include/$CROSS -D__ANDROID_API__=$ANDROID_VERSION -U_FILE_OFFSET_BITS"
    CROSS_PREFIX=${TOOLCHAIN}/bin/${CROSS}-
    build(){
    echo "configuring $ANDROID_ARCH_ABI ANDROID_VERSION=$ANDROID_VERSION"
    ./configure \
       --prefix=$PREFIX \
       --enable-neon \
       --enable-hwaccels \
       --enable-gpl \
       --enable-postproc \
       --enable-shared \
       --enable-jni \
       --enable-mediacodec \
       --enable-decoder=h264_mediacodec \
       --enable-hwaccel=h264_mediacodec \
       --enable-decoder=hevc_mediacodec \
       --enable-decoder=mpeg4_mediacodec \
       --enable-decoder=vp8_mediacodec \
       --enable-decoder=vp9_mediacodec \
       --disable-static \
       --disable-doc \
       --enable-ffmpeg \
       --disable-ffplay \
       --disable-ffprobe \
       --enable-avdevice \
       --disable-doc \
       --disable-symver \
       --cross-prefix=$CROSS_PREFIX \
       --target-os=android \
       --arch=$ARCH \
       --disable-yasm \
       --enable-cross-compile \
       --sysroot=$SYSROOT \
       --extra-cflags="$CFLAGS " \
       --extra-ldflags="$ADDI_LDFLAGS" \
       $ADDITIONAL_CONFIGURE_FLAG
       make clean
       make -j4
       make install
       echo "$ANDROID_ARCH_ABI installed"
    }
    build

    I wonder how to do it with clang friendly.I’m still new int the NDK and I’ve just started learning.So I have no idea to do it at all.
    When I was trying turn to clang,and get many errors.
    After trying so many times,I update my build script with this question :

    FFMPEG source compilation failed with Android NDK Clang compiler (r16b) with error "the clang compiler does not support ’-mcpu=arm’"

    #!/bin/sh
    #r16b min support android-14  max android-8.1
    NDK=/home/gjy/ndk/android-ndk-r16b-linux-x86_64/android-ndk-r16b
    ANDROID_VERSION=19
    TOOLCHAIN_VERSION=4.9
    BUILD_PLATFORM=linux-x86_64
    ARCH=arm
    ANDROID_ARCH_ABI=armeabi
    HOST=arm-linux-androideabi
    CROSS=arm-linux-androideabi
    SYSROOT=${NDK}/platforms/android-${ANDROID_VERSION}/arch-${ARCH}/
    PREFIX=$(pwd)/android/${ANDROID_VERSION}/$ANDROID_ARCH_ABI
    TOOLCHAIN=${NDK}/toolchains/llvm/prebuilt/${BUILD_PLATFORM}/bin
    #LD
    LD=${NDK}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}/bin/${CROSS}-ld
    #AS
    AS=${NDK}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}/bin/${CROSS}-as
    #AR
    AR=${NDK}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}/bin/${CROSS}-ar
    CFLAGS="-mcpu=$ARCH -I$NDK/sysroot/usr/include/$CROSS -D__ANDROID_API__=$ANDROID_VERSION"
    CROSS_PREFIX=${NDK}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}/bin/${CROSS}-
    build(){
    echo "configuring $ANDROID_ARCH_ABI ANDROID_VERSION=$ANDROID_VERSION"
    ./configure \
       --prefix=$PREFIX \
       --toolchain=clang-usan \
       --cross-prefix=$CROSS_PREFIX \
       --enable-neon \
       --enable-hwaccels \
       --enable-gpl \
       --enable-postproc \
       --enable-shared \
       --disable-static \
       --enable-jni \
       --enable-mediacodec \
       --enable-decoder=h264_mediacodec \
       --enable-hwaccel=h264_mediacodec \
       --enable-decoder=hevc_mediacodec \
       --enable-decoder=mpeg4_mediacodec \
       --enable-decoder=vp8_mediacodec \
       --enable-decoder=vp9_mediacodec \
       --disable-doc \
       --enable-ffmpeg \
       --disable-ffplay \
       --disable-ffprobe \
       --enable-avdevice \
       --disable-doc \
       --disable-symver \
       --target-os=android \
       --extra-ldflags="-shared" \
       --arch=$ARCH \
       --cpu=$ANDROID_ARCH_ABI \
       --extra-cflags="-fPIE -fPIC -ffast-math -funroll-loops -mfloat-abi=softfp -mfpu=vfpv3-d16" \
       --enable-x86asm \
       --enable-cross-compile \
       --cc=$TOOLCHAIN/clang \
       --cxx=$TOOLCHAIN/clang++ \
       --ld=$LD \
       --as=$AS \
       --ar=$AR \
       --strip=${NDK}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}/${CROSS}-strip \
       $ADDITIONAL_CONFIGURE_FLAG
       #make clean
       #make -j4
       #make install
       echo "$ANDROID_ARCH_ABI installed"
    }
    build

    then I get error form config.log :

    /home/gjy/ndk/android-ndk-r16b-linux-x86_64/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -fPIE -fPIC -ffast-math -funroll-loops -mfloat-abi=softfp -mfpu=vfpv3-d16 -mcpu=armeabi -fPIC -c -o /tmp/ffconf.hfTGr6sO/test.o /tmp/ffconf.hfTGr6sO/test.S
    /home/gjy/ndk/android-ndk-r16b-linux-x86_64/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as: invalid option -- '_'
    GNU assembler not found, install/update gas-preprocessor

    it seems like that the frist char was ignored. When I try :

    /home/gjy/ndk/android-ndk-r16b-linux-x86_64/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-as -fPIC -c -o /tmp/ffconf.jHtqLsFE/test.o /tmp/ffconf.jHtqLsFE/test.S
    invalid option -- P

    can any body help fine the problem?