Recherche avancée

Médias (91)

Autres articles (71)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (6692)

  • How to stream 24/7 on youtube (audio + video) with FFMPEG

    29 septembre 2023, par Carter510

    I plan to create a 24/7 stream with a video and a musical background which is located in a /Playlist folder.
I would like the music playlist to be played randomly and if a piece of music is corrupted or cannot be played, the program moves on to the next one.

    


    The problem is that with my command every time the music changes the stream stops.
Any suggestions ?

    


    #!/bin/bash

VBR="4500k"
FPS="30"
QUAL="superfast"

YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"
KEY="XXXX-XXXX-XXXX-XXXX"

VIDEO_SOURCE="fireplace.mkv"
AUDIO_FOLDER="/home/administrateur/Documents/Youtube/Playlist"

while true; do
    # Joue la vidéo en boucle
    ffmpeg -re -stream_loop -1 -i "$VIDEO_SOURCE" \
    -thread_queue_size 512 -i "$(find "$AUDIO_FOLDER" -type f -name "*.mp3" | shuf -n 1)" \
    -map 0:v:0 -map 1:a:0 \
    -map_metadata:g 1:g \
    -vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \
    -acodec libmp3lame -ar 44100 -threads 6 -qscale:v 3 -b:a 320000 -bufsize 512k \
    -f flv "$YOUTUBE_URL/$KEY"
done


    


    I would like the fireplace.mkv video to play without interruption, for the music to be chosen randomly without ever stopping. And if one of the songs cannot be played, it is skipped.

    


  • Firebase function to convert YouTube to mp3

    9 octobre 2023, par satchel

    I want to deploy to Firebase cloud functions.

    


    However, I get a vague error : “Cannot analyze code” after it goes through the initial pre deploy checks successfully.

    


    But I cannot figure out the problem given the vagueness of the error.

    


    It looks right with these requirements :

    


      

    • receive a POST with JSON body of YouTube videoID as a string
    • 


    • Download locally using the YouTube download package
    • 


    • Pipe to the ffmpeg package and save mp3 to the local temp
    • 


    • Store in default bucket on firestore storage
    • 


    • Apply make public method to make public
    • 


    


    const functions = require('firebase-functions');
const admin = require('firebase-admin');
const ytdl = require('ytdl-core');
const ffmpeg = require('fluent-ffmpeg');
const fs = require('fs');
const path = require('path');
const os = require('os');

admin.initializeApp();

// Set the path to the FFmpeg binary
const ffmpegPath = path.join(__dirname, 'bin', 'ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);

exports.audioUrl = functions.https.onRequest(async (req, res) => {
    if (req.method !== 'POST') {
        res.status(405).send('Method Not Allowed');
        return;
    }

    const videoId = req.body.videoID;
    const videoUrl = `https://www.youtube.com/watch?v=${videoId}`;
    const audioPath = path.join(os.tmpdir(), `${videoId}.mp3`);

    try {
        await new Promise((resolve, reject) => {
            ytdl(videoUrl, { filter: format => format.container === 'mp4' })
                .pipe(ffmpeg())
                .audioCodec('libmp3lame')
                .save(audioPath)
                .on('end', resolve)
                .on('error', reject);
        });

        const bucket = admin.storage().bucket();
        const file = bucket.file(`${videoId}.mp3`);
        await bucket.upload(audioPath, {
            destination: file.name,
            metadata: {
                contentType: 'audio/mp3',
            },
        });

        // Make the file publicly accessible
        await file.makePublic();

        const publicUrl = file.publicUrl();
        res.status(200).send({ url: publicUrl });
    } catch (error) {
        console.error('Error processing video:', error);
        res.status(500).send('Internal Server Error');
    }
});


    


    The following is the package.json file which is used to reference the dependencies for the function, as well as the entry point, which I believe just needs to be the name of the filename with the code :

    


    {
  "name": "firebase-functions",
  "description": "Firebase Cloud Functions",
  "main": "audioUrl.js", 
  "dependencies": {
    "firebase-admin": "^10.0.0",
    "firebase-functions": "^4.0.0",
    "ytdl-core": "^4.9.1",
    "fluent-ffmpeg": "^2.1.2"
  },
  "engines": {
    "node": "18"
  },
  "private": true
}


    


    (Edit) Here is the error :

    


     deploying functions
✔  functions: Finished running predeploy script.
i  functions: preparing codebase default for deployment
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: Loading and analyzing source code for codebase default to determine what to deploy
Serving at port 8171

shutdown requested via /__/quitquitquit


Error: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error


    


    Failed to load function definition from source: FirebaseError: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error


    


    I get the same error when running the following :

    


    firebase deploy --only functions:audioUrl


    


    And I thought I might get more detailed errors using the emulator :

    


    firebase emulators:start


    


    Under the emulator I had this additional error initially :

    


    Your requested "node" version "18" doesn't match your global version "16". Using node@16 from host.


    


  • FFMPeg generated video : Audio has 'glitches' when uploaded to YouTube

    7 octobre 2023, par CularBytes

    I've generated a voice from Azure AI Speech at 48KHz and 96K Bit Rate, generated a video of some stock footages and I'm trying to combine all of that with a background music.
The voice-over is generated per setence, so that I know how long each setence is and to include relevant video footage.

    


    I'm using FFMpeg through the FFMpegCore nuget package.

    


    The problem

    


    After the video is complete with background music, I play it on my computer and it's perfect (no audio glitches, music keeps playing). But when uploaded to youtube it has 'breaks' in the music inbetween sentences (basically everytime a new voice-fragment is starting).

    


    Example : https://www.youtube.com/watch?v=ieNvQ2TNq44

    


    The code

    


    All of the footage is combined with mostly FFMpeg.Join(string output, string[] videos). These video files also contain the voice-overs (per sentance).

    


    After that I try to add the music like this :

    


       string outputTimelineWithMusicPath = _workingDir + $@"\{videoTitle}_withmusic.mp4";
    FFMpegArguments
        .FromFileInput(inputVideoPath)
        .AddFileInput(musicPath)
        .OutputToFile(outputPath, true, options => options
            .CopyChannel()
            .WithAudioCodec(AudioCodec.Aac)
            .WithAudioBitrate(AudioQuality.Good)
            .UsingShortest(true)
            .WithCustomArgument("-filter_complex \"[0:a]aformat=fltp:44100:stereo,apad[0a];[1]aformat=fltp:44100:stereo,volume=0.05[1a];[0a][1a]amerge[a]\" -map 0:v -map \"[a]\" -ac 2"))
        .ProcessSynchronously();


    


    I've tried to mess around with the CustomArgument, but so far no success.

    


    For example, I thought removing apad from the argument so no 'blank spots' are added, should perhaps fix the issue. Also tried to use amix instead of amerge.

    


    Last try

    


    I've tried to first make sure both files had the same sample rate, in the hope to fix the issue. So far, no success

    


        string outputVideoVoicePath = _workingDir + $@"\{title}_voiceonly_formatting.mp4";
    string musicReplacePath = _workingDir + $@"\{title}_music_formatted.aac";
    FFMpegArguments
    .FromFileInput(inputVideoPath)
    .OutputToFile(outputVideoVoicePath, true, options => options
        .WithAudioCodec(AudioCodec.Aac)
        .WithAudioBitrate(128)
        .WithAudioSamplingRate(44100)
    )
    .ProcessSynchronously();
    
    FFMpegArguments
        .FromFileInput(music.FilePath)
        .OutputToFile(musicReplacePath, true, options => options
            .WithAudioCodec(AudioCodec.Aac)
            .WithAudioBitrate(256) //also tried 96 (which is original format)
            .WithAudioSamplingRate(44100)
        )
        .ProcessSynchronously();
    
    
    Console.WriteLine("Add music...");
    var videoTitle = Regex.Replace(title, "[^a-zA-Z]+", "");
    string outputTimelineWithMusicPath = _workingDir + $@"\{videoTitle}_withmusic.mp4";
    FFMpegArguments
        .FromFileInput(outputVideoVoicePath)
        .AddFileInput(musicReplacePath)
        .OutputToFile(outputTimelineWithMusicPath, true, options => options
            .CopyChannel()
            .WithAudioCodec(AudioCodec.Aac)
            .WithAudioBitrate(AudioQuality.Good)
            .UsingShortest(true)
            .WithCustomArgument("-filter_complex \"[0:a]aformat=fltp:44100:stereo[0a];[1]aformat=fltp:44100:stereo,volume=0.05[1a];[0a][1a]amix=inputs=2[a]\" -map 0:v -map \"[a]\" -ac 2"))
        .ProcessSynchronously();
    return outputTimelineWithMusicPath;


    


    I'm not much of an expert when it comes to audio/video codecs. I do scale each stock video to 24fps, 1920x1080 and the music has a original bitrate of 256Kbps / 44100 sample rate (so I probably don't even have to convert the audio file).