Recherche avancée

Médias (91)

Autres articles (100)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

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

Sur d’autres sites (10848)

  • Attempting to use recursion, why does my code only download 4 videos and exit ?

    16 avril 2024, par Andrew Atwood

    I am attempting to download videos from an API that I have access to. This should loop through all of the videos that were returned from the API call, save them to disc, use ffmpeg to verify the meta data from the API (this step is necessary because the API is sometimes returning incorrect information), then save attribution information and continue on if no error. However, my output from the below code is simple this :

    


    []
Download Done: 0
Saved 'Owner: Anthony �; Owner URL: https://www.pexels.com/@inspiredimages' to animals.txt     
13
0
Download Done: 1
Saved 'Owner: PMA; Owner URL: https://www.pexels.com/@pma-1470250' to animals.txt
35
1
Download Done: 2
Saved 'Owner: Pressmaster; Owner URL: https://www.pexels.com/@pressmaster' to animals.txt      
65
2
Download Done: 3
Saved 'Owner: Ruvim Miksanskiy; Owner URL: https://www.pexels.com/@digitech' to animals.txt    
75
3


    


    No errors, no exit code. Just stops running. I've walked through the process in my head a few times, and I can't figure out why it only gets called 4 times. Would anyone have any insight as to where I could try troubleshooting ?

    


    Code Here :

    


    require("dotenv").config();
const axios = require("axios");
const concat = require("ffmpeg-concat");
const fluent = require("fluent-ffmpeg");
const fs = require("fs");

const PEXELS_API_KEY = process.env.PEXELS_API_KEY;

const SUBTOPIC = "animals";

const URLBase = `https://api.pexels.com/videos/search?query=${SUBTOPIC}&per_page=80&size=medium&orientation=landscape`;
let rVideos;
let videosToConcat = [];
let duration = 0;
let current = 0;

const fetchVideos = async () => {
  const response = await axios.get(URLBase, {
    headers: {
      Authorization: PEXELS_API_KEY,
    },
  });

  return response.data.videos;
};

const writeVideoToDisc = async (videoObj) => {
  let found = false;
  videoObj.forEach(async (file, index) => {
    if (
      found === false &&
      file.quality === "hd" &&
      file.width === 1920 &&
      file.height === 1080 &&
      file.file_type === "video/mp4"
    ) {
      found = true;
      let writer = fs.createWriteStream("raw/" + current + ".mp4");
      let streamResponse = await axios({
        url: rVideos[current].video_files[index].link,
        method: "get",
        responseType: "stream",
      });
      streamResponse.data.pipe(writer);
      writer.on("finish", () => {
        console.log(`Download Done: ${current}`);
        fluent.ffprobe(`./raw/${current}.mp4`, (err, metadata) => {
          if (err) {
            console.error(err);
          } else {
            if (
              metadata.streams[0].width !== 1920 ||
              metadata.streams[0].height !== 1080
            ) {
              fs.unlink(`./raw/${current}.mp4`, (err) => {
                if (err) throw err;
                console.log("File deleted!");
              });
            } else {
              duration += rVideos[current].duration;
              videosToConcat.push(`./raw/${current}.mp4`);
              fs.appendFile(
                `./attribution/${SUBTOPIC}.txt`,
                `Owner: ${rVideos[current].user.name}; Owner URL: ${rVideos[current].user.url} \n`,
                function (err) {
                  if (err) throw err;
                  console.log(
                    `Saved 'Owner: ${rVideos[current].user.name}; Owner URL: ${rVideos[current].user.url}' to ${SUBTOPIC}.txt`
                  );
                  if (duration < 600) {
                    console.log(duration);
                    console.log(current);
                    current++;
                    writeVideoToDisc(rVideos[current].video_files);
                  }
                }
              );
            }
          }
        });
      });
      writer.on("error", () => console.error("Error while dowloading video"));
    }
  });
};

const main = async () => {
  rVideos = await fetchVideos();
  console.log(rVideos.length);
  await writeVideoToDisc(rVideos[current].video_files);
  console.log(videosToConcat);
  // concat videos together
};

main();


    


  • Mp3 streaming still download in progress

    10 mars 2018, par edadam

    I have streaming an mp3 file, from my server, while that’s not fully downloaded for the server. The client detects just the already downloaded audio length. How can I show the original length, if I know that ? Can I write it as id3 tag, for example ?

    Server : Debian, Lighttpd, Ffmpeg, bash cgi

  • hls : detect SAMPLE-AES encryption

    5 mars 2015, par selsta
    hls : detect SAMPLE-AES encryption
    

    SAMPLE-AES encryption is not commonly used yet, but without this patch
    ffmpeg is thinking that the hls segments are not encrypted which
    produces broken files.

    Signed-off-by : Michael Niedermayer <michaelni@gmx.at>

    • [DH] libavformat/hls.c