Recherche avancée

Médias (91)

Autres articles (67)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

Sur d’autres sites (5598)

  • Build FFMPEG under Cygwin in Windows OS for Android

    8 juin 2017, par Jun Kim

    For the past couple days, I have been trying hard to build FFMPEG for a Android project on Windows Operating System using android-ndk-14d using Cygwin.
    I have followed many tutorials out there, and I ahve encountered so many errors while building FFMPEG using build_android.sh.

    Here are the steps that I have taken so far.

    I downloaded Cygwin and configured all the dependencies that I need for building FFMPEG.

    I opened ffmpeg-3.3.1/configure file with a text editor, and changed to the following lines.

    SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
    LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
    SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
    SLIB_INSTALL_LINKS='$(SLIBNAME)'

    my build_android.sh is as below

    #!/bin/bash
    NDK=C:/~/ndk-bundle
    SYSROOT=$NDK/platforms/android-21/arch-arm/
    TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64
    function build_one
    {
    ./configure \
       --prefix=$PREFIX \
       --enable-shared \
       --disable-static \
       --disable-doc \
       --disable-ffmpeg \
       --disable-ffplay \
       --disable-ffprobe \
       --disable-ffserver \
       --disable-avdevice \
       --disable-doc \
       --disable-symver \
       --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi-\
       --target-os=android \
       --arch=arm \
       --cpu=armv7-a \
       --enable-cross-compile \
       --sysroot=$SYSROOT \
       --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
       --extra-ldflags="$ADDI_LDFLAGS" \
       $ADDITIONAL_CONFIGURE_FLAG
    make clean
    make
    make install
    }
    CPU=arm
    PREFIX=$(pwd)/android/$CPU
    ADDI_CFLAGS="-marm"
    build_one

    I ran these commands

    dos2unix build_android.sh
    chmod +x build_android.sh
    ./build_android.sh

    and,,,currently getting this error

    c :/users/sonic/appdata/local/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/p
    rebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-an
    droideabi/bin/ld.exe : error : libavutil/libavutil.so:1:1 : syntax error,
    unexpected ’ !’, exp ecting $end

    c :/users/sonic/appdata/local/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/p
    rebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-an
    droideabi/bin/ld.exe : error : libavutil/libavutil.so : not an object or
    archive collect2.exe : error : ld returned 1 exit status
    make : *** [library.mak:94 : libswscale/libswscale-4.so] Error 1 LD

    libswscale/libswscale-4.so
    c :/users/sonic/appdata/local/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/p
    rebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-an
    droideabi/bin/ld.exe : error : libavutil/libavutil.so:1:1 : syntax error,
    unexpected ’ !’, exp ecting $end

    c :/users/sonic/appdata/local/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/p
    rebuilt/windows-x86_64/bin/../lib/gcc/arm-linux->androideabi/4.9.x/../../../../arm-linux-an
    droideabi/bin/ld.exe : error : libavutil/libavutil.so : not an object or
    archive collect2.exe : error : ld returned 1 exit status make : ***
    [library.mak:94 : libswscale/libswscale-4.so] Error 1

    How to compile ffmpeg-2.5.3 on windows with android-ndk-r10d

    From the comments that were commented on the above link, it seems like it is
    easier to build FFMPEG in Linux/Unix OS. My first can be a dumb question. But If there is anyone who can guide me through this, i will be really appreciated it.

    If I build FFMPEG on Linux for Android, could I possibly copy or move those
    resulted output (The arm/lib folder contains the shared libraries, while arm/include folder contains the header files for libavcodec, libavformat, libavfilter, libavutil, libswscale etc.) to Windows OS and utilize them for
    my Android project ?

    Since my company only provides Windows OS for a project, I have to utilize them on Windows OS.

    Thank you for your time, and if there is any feedback that you can provide it will definitely be helpful.

    For the reference, here is my config.log

    END c :/ffmpegtmp/ffconf.qoBF6X98.c
    C :/Users/sonic/AppData/Local/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc —sysroot=C :/Users/sonic/AppData/Local/Android/sdk/ndk-bundle/platforms/android-9/arch-arm/

    -isysroot C :/Users/sonic/AppData/Local/Android/sdk/ndk-bundle/platforms/android-9/arch-arm/
    -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -Os -fpic -marm -march=armv7-a -std=c11 -fomit-frame-pointer -fPIC -marm -pthread -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -c -o c :/ffmpegtmp/ffconf.8joa74tC.o

    c :/ffmpegtmp/ffconf.qoBF6X98.c
    check_cflags -fdiagnostics-color=auto test_cflags
    -fdiagnostics-color=auto check_cc -fdiagnostics-color=auto BEGIN c :/ffmpegtmp/ffconf.qoBF6X98.c
    1 int x ; END c :/ffmpegtmp/ffconf.qoBF6X98.c C :/Users/sonic/AppData/Local/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc —sysroot=C :/Users/sonic/AppData/Local/Android/sdk/ndk-bundle/platforms/android-9/arch-arm/

    -isysroot C :/Users/sonic/AppData/Local/Android/sdk/ndk-bundle/platforms/android-9/arch-arm/
    -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -Os -fpic -marm -march=armv7-a -std=c11 -fomit-frame-pointer -fPIC -marm -pthread -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -fdiagnostics-color=auto -c -o c :/ffmpegtmp/ffconf.8joa74tC.o c :/ffmpegtmp/ffconf.qoBF6X98.c test_cflags -Wmaybe-uninitialized check_cc -Wmaybe-uninitialized BEGIN

    c :/ffmpegtmp/ffconf.qoBF6X98.c
    1 int x ; END c :/ffmpegtmp/ffconf.qoBF6X98.c C :/Users/sonic/AppData/Local/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc —sysroot=C :/Users/sonic/AppData/Local/Android/sdk/ndk-bundle/platforms/android-9/arch-arm/

    -isysroot C :/Users/sonic/AppData/Local/Android/sdk/ndk-bundle/platforms/android-9/arch-arm/
    -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -Os -fpic -marm -march=armv7-a -std=c11 -fomit-frame-pointer -fPIC -marm -pthread -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -fdiagnostics-color=auto -Wmaybe-uninitialized -c -o c :/ffmpegtmp/ffconf.8joa74tC.o c :/ffmpegtmp/ffconf.qoBF6X98.c

  • upload and stream ffmpeg stream chunk and mpd file in s3

    29 juin 2024, par Kamruzzaman Rabeen

    i want to make ann web app where i can upload a video. After uploading video its should be compress by ffmpeg after that i want to keep the data on aws S3.

    


    I can compress by ffmpeg. but i have no idea which file i should keep in s3 because after compress its create many chunk file and one mpd xml file.

    


    Also i want to stream the video from mpd file after fetching data from s3.
here is my upload function code.
const videoPath = req.file.path; const outputDir = path.join(__dirname, 'dash'); const uniqueId = uuidv4(); const outputFilePath = path.join(outputDir, $uniqueId_stream.mpd); const bucketName = process.env.S3_BUCKET_NAME; const s3Key = dash/$uniqueId_stream.mpd` ;

    


    // Ensure the output directory exists
if (!fs.existsSync(outputDir)) {
    fs.mkdirSync(outputDir, { recursive: true });
}

ffmpeg(videoPath)
    .outputOptions([
        '-profile:v main',
        '-use_template 1',
        '-use_timeline 1',
        '-b:v 1000k',
        '-b:a 128k',
        '-f dash'
    ])
    .on('end', async () => {
        console.log('DASH file created successfully');
        try {
            const s3Url = await uploadToS3(outputFilePath, bucketName, s3Key);
            res.status(200).json({ message: 'Video uploaded and DASH file created', url:    s3Url });
        } catch (err) {
            console.error('Error uploading to S3: ', err);
            res.status(500).json({ message: 'Error uploading to S3', error: err.message });
        }
    })
    .on('error', (err) => {
        console.error('Error processing video: ', err);
        res.status(500).json({ message: 'Error processing video', error: err.message });
    })
    .save(outputFilePath);`

`const uploadToS3 = (filePath, bucketName, key) => {
return new Promise((resolve, reject) => {
    fs.readFile(filePath, (err, data) => {
        if (err) return reject(err);

        const params = {
            Bucket: bucketName,
            Key: key,
            Body: data,
            ContentType: 'application/dash+xml'
        };

        s3.upload(params, (err, data) => {
            if (err) return reject(err);
            resolve(data.Location);
        });
    });
});


    


     ;`

    


    i have tried this version of code.

    


    now i want to know what is the best to way to keep data in s3 for compress video after ffmpeg.

    


  • Transform video and image with multer-s3-transform

    6 mai 2022, par Nguyen Hoang Vu

    I'm trying to upload media to S3 with multer-s3-transform
Here is my endpoint :

    


    router.post(
    ROUTE_CONSTANT.PRODUCT_IMAGES,
    validation.verifyProductExisted,
    uploadImage.single('image'),
    uploadProductImage
  );


    


    Here is my multer-s3-transform implementation :

    


      const uploadImage = multer({
  fileFilter: imageTypeFilter,
  limits: {
    fileSize: configEnv.mediaFileSizeLimit * 1024 * 1024,
  },
  storage: multerS3({
    s3,
    bucket: configEnv.productMediaBucket,
    acl: 'public-read',
    contentType: multerS3.AUTO_CONTENT_TYPE,
    shouldTransform(
      req: Request,
      file: Express.Multer.File,
      cb: (arg0: any, arg1: boolean) => void
    ) {
      cb(null, true);
    },
    transforms: [
      {
        id: 'original',
        key(
          req: Request,
          file: Express.Multer.File,
          cb: (arg0: any, arg1: string) => void
        ) {
          const fileName = `${req.params.id}-${new Date().getTime()}`;
          if (imageMimeType.includes(file.mimetype)) {
            cb(null, `images/${fileName}.jpg`);
          } else {
            cb(null, `videos/${fileName}.mp4`);
          }
        },
        transform(req: Request, file: Express.Multer.File, cb: any) {
          if (imageMimeType.includes(file.mimetype)) {
            cb(null, sharp().jpeg());
          } else {
            cb(
              null,
              ffmpeg()
                .videoCodec('libx264')
                .audioCodec('aac')
                .outputFormat('mp4')
                .outputOptions(['-movflags frag_keyframe+empty_moov'])
            );
          }
        },
      },
    ],
  }),
});


    


    The image's part is working fine with Sharp, now I want to use fluent-ffmpeg to transform the video as well. I still can not figure out how to make the ffmpeg return a ReadableStream or Buffer so that it can be uploaded to S3 due to this code of multer-s3-transform :

    


      storage.getTransforms[i].transform(req, file, function (err, piper) {
  if (err) return cb(err);
  
  var upload = storage.s3.upload({
    Bucket: opts.bucket,
    Key: key,
    ACL: opts.acl,
    CacheControl: opts.cacheControl,
    ContentType: opts.contentType,
    Metadata: opts.metadata,
    StorageClass: opts.storageClass,
    ServerSideEncryption: opts.serverSideEncryption,
    SSEKMSKeyId: opts.sseKmsKeyId,
    Body: (opts.replacementStream || file.stream).pipe(piper),
  });


    


    Many thanks