Recherche avancée

Médias (91)

Autres articles (96)

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

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (10037)

  • FFMPEG buffer input to mp4

    2 novembre 2020, par Michael Joseph Aubry

    How to properly send a buffer array to FFMPEG ?

    


    The process I am creating looks like this. A puppeteer session is open, requestAnimationFrame is called inside the browser context, then the frame is sent to Nodejs as a base64 string, this happens over and over again because requestAnimationFrame is inside a recursive function. The buffer will send each frame through one at a time.

    


    Before passing into FFMPEG I am converting the base64 string into a readable buffer because FFMPEG has a limited selection of input types.

    


    const buf = Buffer.from(base64, "base64");
let readableVideoBuffer = new stream.PassThrough();
readableVideoBuffer.write(buf, "utf8");
readableVideoBuffer.end();


    


    My goal with FFMPEG is to keep the process going until no more bytes are sent through. I want to pass each buffer as a frame and have FFMPEG stitch together the frames into an mp4 video. The output should be a writable file that is open to writing until the buffer stream closes.

    


    enter image description here

    


    Here is the code I have been experimenting with

    


    export default (base64: any) => {
  const buf = Buffer.from(base64, "base64");
  let readableVideoBuffer = new stream.PassThrough();
  readableVideoBuffer.write(buf, "utf8");
  readableVideoBuffer.end();

  const childProcess = spawn(ffmpegPath.path, [
    "-f",
    "image2pipe",
    "-r",
    "25",
    "-s",
    "1080x1080",
    "-i",
    "-",
    "-vcodec",
    "libx264",
    "-pix_fmt",
    "yuv420p",
    "-movflags",
    "faststart",
    "-f",
    "mp4",
    "pipe:1"
  ]);

  childProcess.stdout.on("data", (data) =>
    fs.createWriteStream("~/Desktop/test.mp4").write(data)
  );
  childProcess.stderr.on("data", (data) => console.log(data.toString()));
  childProcess.on("close", (code) => {
    console.log(`done! (${code})`);
  });

  readableVideoBuffer.pipe(childProcess.stdin);
};


    


    I don't understand what is required to fully make this work. I do know if the input -i - is a dash - then that signals the input will be read from childProcess.stdin. If I don't specify an input format like -f image2pipe then the command will fail.

    


    If I specify an output like ~/Desktop/test.mp4 I get an error File '~/Desktop/test.mp4' already exists. Exiting.

    


    With the code I have in the example above the error I get is [image2pipe @ 0x7f93f4004400] Could not find codec parameters for stream 0 (Video: none, none, 1080x1080): unknown codec Consider increasing the value for the 'analyzeduration' and 'probesize' options

    


    So it seems like this version may work if I can figure out how to prevent the command from trying to overwrite the video on the next buffer sequence and do some sort of passthrough and keep the write open.

    


    Any ideas ?

    


  • pipe youtube-dl to ffmpeg within a script

    28 février 2016, par user556068

    This is an expansion to an earlier question I asked which you can find here. I have been piping youtube-dl into a script via youtube-dl -iga /path/to/myFile.txt | myscript.sh which reads a text file of urls and extracts another set of urls to the actual video content being downloaded. Everything works great but there is much room for improvement.

    Instead of piping youtube-dl into the script I would like to include the youtube-dl command within the script itself. Here is the full script I have up to this point.

    #!/bin/bash  

    inArgs='-i'                
    outArgs='-c copy -y'        
    dir="$HOME/Movies/fftest/"
    outFile="fftest_${count}"      
    ext='.mp4'        

    #### not sure about following 2 lines

    youtube-dl -iga /path/to/myFile.txt > /path/to/myFile2.txt
    exec 0to/myFile2.txt

    count=0
    if [ ! -d "${dir}" ];
    then
    mkdir -p "${dir}"
    fi      
    cd || "${HOME}"

    while read lineIn
    do
    {
    (( count ++ ))
    echo ffmpeg $inArgs $lineIn $outArgs "$dir$outFile$count$ext" &
    sleep 1
    }  
    done  

    After playing around with it a little I added the following lines. Code has been edited to reflect these changes.

    youtube-dl -iga /path/to/myFile.txt > /path/to/myFile2.txt
    exec 0to/myFile2.txt

    This does work but it’s also throwing up some new error from ffmpeg that I haven’t yet encountered until now. I test by placing echo before the ffmpeg command. Everything looks fine doing that so I’m not really sure what the issue is at this point.

    So there are a couple things i would like to accomplish that I haven’t been able to figure out.

    • Have I properly redirected the input and do I need to do anything later in the script to put things back as they were before the script was called or will that occur naturally on its own when exiting the script ?

    • As it currently is, the script will overwrite any files previously created every time it is called. This is fine for testing purposes but not ideal beyond that. What I am looking for is a way to start writing the next file in the number sequence based on the last file in the directory. So if one time it creates 8 files named fftest_1.mpr - fftest_8.mp4 the second time when it is called to create 14 new files, it will know to start writing a file labeled fftest_9.mp4 - fftest_22.mp4. This is however beyond my abilities at the moment. Is there a way to do this ?

    • Another issue I’ve had is when trying kill the script as it runs in the background. Ctrl C doesn’t have any effect as far as I can tell. Is there an alternative kill command or key press I can use to ensure an immediate exit if necessary. Or a way to assign such within the script itself ?

    • Also any critiques, suggestions, alternatives or additions to any part of this script are very much welcomed and appreciated. This is all very new for me and I’m trying to learn more everyday. If any part of what I said didn’t make sense I will be happy to clarify.

  • MacOS - how to choose audio device from terminal

    9 octobre 2024, par jon_two

    I've been working on a Python program to create audio and also play back existing sound files. I can spawn multiple processes and have them all play to the laptop speakers, but I was wondering if it was possible to send each signal to a separate sound device. This is so I can apply effects to some processes but not all together.

    


    I'm using a MacBook and python simpleaudio, which calls AudioToolbox to connect to the output device. I've also got ffmpeg installed, so could use ffplay if that is easier. The pydub library uses this - it exports the current wave to a temp file then uses subprocess and ffplay to play it back.

    


    I can get a list of devices, but am not sure how to use this list to choose a device.

    


    % ffplay -devices
Devices:
 D. = Demuxing supported
 .E = Muxing supported
 --
  E audiotoolbox    AudioToolbox output device
 D  avfoundation    AVFoundation input device
 D  lavfi           Libavfilter virtual input device
  E sdl,sdl2        SDL2 output device
 D  x11grab         X11 screen capture, using XCB


    


    I did see a post that suggested using ffmpeg to list devices, again I can't figure out how to use this list.

    


    % ffmpeg -f lavfi -i sine=r=44100 -f audiotoolbox -list_devices true -
Input #0, lavfi, from 'sine=r=44100':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[AudioToolbox @ 0x135e3f230] CoreAudio devices:
[AudioToolbox @ 0x135e3f230] [0]               Background Music, (null)
[AudioToolbox @ 0x135e3f230] [1]   Background Music (UI Sounds), BGMDevice_UISounds
[AudioToolbox @ 0x135e3f230] [2]         MacBook Air Microphone, BuiltInMicrophoneDevice
[AudioToolbox @ 0x135e3f230] [3]           MacBook Air Speakers, BuiltInSpeakerDevice
[AudioToolbox @ 0x135e3f230] [4]               Aggregate Device, ~:AMS2_Aggregate:0
Output #0, audiotoolbox, to 'pipe:':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
    Metadata:
      encoder         : Lavc59.37.100 pcm_s16le
size=N/A time=00:00:05.06 bitrate=N/A speed=0.984x    
video:0kB audio:436kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.


    


    This does at least give me a recognisable list of devices. If I add more Aggregate Devices, can I play back different files to each device ?