Recherche avancée

Médias (39)

Mot : - Tags -/audio

Autres articles (111)

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

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Changer son thème graphique

    22 février 2011, par

    Le thème graphique ne touche pas à la disposition à proprement dite des éléments dans la page. Il ne fait que modifier l’apparence des éléments.
    Le placement peut être modifié effectivement, mais cette modification n’est que visuelle et non pas au niveau de la représentation sémantique de la page.
    Modifier le thème graphique utilisé
    Pour modifier le thème graphique utilisé, il est nécessaire que le plugin zen-garden soit activé sur le site.
    Il suffit ensuite de se rendre dans l’espace de configuration du (...)

Sur d’autres sites (4414)

  • Lambda/ffmpeg timelapse generation - output zero bytes, can't debug ffmpeg

    25 août 2021, par GoOutside

    I am attempting to use an AWS Lambda FFMPEG layer to build a timelapse of static images in an S3 bucket. To begin, I am basing my project off of the tutorial located here.

    


    I can replicate the steps in the tutorial, so I know the FFMPEG layer is working in Lambda. I have replicated the FFMPEG commands on a standalone server, so I know they are correct.

    


    Here is my setup : I have two S3 buckets, lambda-source-bucket and lambda-destination-bucket. The contents of lambda-source-bucket are :

    


    1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
files.txt


    


    The files.txt contains this :

    


    file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/1.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/2.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/3.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/4.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/5.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/6.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/7.jpg'


    


    This is my Lambda function code (in Python) :

    


    import json
import os
import subprocess
import shlex
import boto3

S3_DESTINATION_BUCKET = "lambda-destination-bucket"
SIGNED_URL_TIMEOUT = 60

def lambda_handler(event, context):

    s3_source_bucket = event['Records'][0]['s3']['bucket']['name']
    s3_source_key = event['Records'][0]['s3']['object']['key']

    s3_source_basename = os.path.splitext(os.path.basename(s3_source_key))[0]
    s3_destination_filename = "timelapse.mp4"

    s3_client = boto3.client('s3')
    s3_source_signed_url = s3_client.generate_presigned_url('get_object',
        Params={'Bucket': s3_source_bucket, 'Key': s3_source_key},
        ExpiresIn=SIGNED_URL_TIMEOUT)

    ffmpeg_cmd = "/opt/bin/ffmpeg -y -r 24 -f concat -safe 0 -protocol_whitelist file,http,tcp,https,tls -I ""https://lambda-source-bucket.s3.us-west-2.amazonaws.com/files.txt"" -c copy -s 1024x576 -vcodec libx264 -"    
command1 = shlex.split(ffmpeg_cmd)
    p1 = subprocess.run(command1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

    resp = s3_client.put_object(Body=p1.stdout, Bucket=S3_DESTINATION_BUCKET, Key=s3_destination_filename)

    return {
        'statusCode': 200,
        'body': json.dumps('Processing complete successfully')
    }


    


    The trigger for the Lambda function is when a new files.txt file is added to lambda-source-bucket.

    


    So far I have been able to get the trigger to fire, the function supposedly runs without errors (in Cloudwatch), and the function creates a new timelapse.mp4 in the lambda-destination-bucket. But this file is 0 bytes. I see no FFMPEG errors in the Cloudwatch console, though I am not sure I know how to configure my Lambda function code to log FFMPEG errors.

    


    Also : if I'm going about this in a totally wrong way, I'd love to hear feedback. I'm guessing that the concat and files.txt method of looping through https:// is not the most efficient way to do this, but it's the only way I can figure this out so far.

    


    Any help is most sincerely and humbly appreciated.

    


  • ffmpeg merge separate .webm audio and video files using pts_time possible ?

    4 août 2021, par Zach

    I have a number of audio and video files with different start times and end times. They're all generated from piped input streams (node.js) with .webm format, so the audio files have gaps where there is no audio in the piped stream.

    


    I'm trying to :

    


      

    1. Merge the audio files together with wall-clock correct start/end times
    2. 


    3. Merge the video files using hstack.
    4. 


    5. Combine the merged audio and merged video into 1 final video with all video/audio.
    6. 


    


    Right now I'm still stuck on step 1 - Merge the audio

    


    My command that generates separate audio files is :

    


            '-protocol_whitelist',
        'pipe,udp,rtp',
        '-fflags',
        '+genpts',
        '-f',
        'sdp',
        '-use_wallclock_as_timestamps',
        'true',
        '-i',
        'pipe:0'
        '-copyts',
        '-map',
        '0:a:0',
        '-strict'
        '-2',
        '-c:a',
        'copy'


    


    I'd love to combine them somehow using the timestamps of each packet fill the empty space with silence. Right now, I'm putting them together with offsets using the time that I initiate the ffmpeg process from node.js, but these times are incorrect, as it takes a moment for ffmpeg to start up.

    


    Any assistance or a push in the right direction for time sensitive merging of audio/video .webm files with ffmpeg would be outstanding.

    


    Thanks !

    


    PS, here's what I'm currently doing and running into a problems with :

    


       '-i',
  './recordings/audio_1.webm',
  '-i',
  './recordings/audio_2.webm',
  '-filter_complex',
  '[1]adelay=6384|6384[b];[0][b]amix=2',
  './recordings/merged_audio.webm'


    


    The delays are inaccurate (because they're based on an estimate of when the first packet starts) and doesn't account for gaps in the audio files :(

    


  • sharedarraybuffer error in edge and firefox but not in chrome when uploading with ffmpeg in nodejs

    29 juillet 2021, par Juliette

    I have the code below in React.js that uses ffmpeg to convert files :

    


    import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg';

  const doTranscode = async () => {
    setMessage('Loading ffmpeg-core.js');
    await ffmpeg.load();
    setMessage('Uploading file');
    ffmpeg.FS('writeFile', filename, await fetchFile(file));
    await ffmpeg.run('-i', filename, 'test.wav');
    setMessage('Upload to manager complete. Sound file will be available and playable on the manger within 1-2 minutes.');
    const data = ffmpeg.FS('readFile', 'test.wav');
    setAudioSrc(URL.createObjectURL(new Blob([data.buffer], { type: 'audio/wav' })));

    var file_name = prompt('What would you like to call this file?');

    if (!file_name) {
      file_name = Date.now()
    }
    
    (async function(){
      let output = await getSoundID(customer_id, file_name);
      let sound_id = output.data;
      var bucket_file = new File([new Blob([data.buffer], { type: 'audio/wav' })], "sounds/" + customer_id + "/" + sound_id + ".wav");
      uploadFileToS3(bucket_file);
      updateSoundData(sound_id, customer_id);
    })();
  };

  useEffect(() => {
    if (file) {
      doTranscode()
    }
  }, [file])


    


    The code above works great in Chrome and the files are successfully converted. However, when I bring it to Firefox or Edge I get this error Unhandled Rejection (ReferenceError): SharedArrayBuffer is not defined.

    


    I looked up this issue and they said I need to modify my headers to include this :

    


    You need to set two response headers for your document:

Cross-Origin-Opener-Policy: same-origin Cross-Origin-Embedder-Policy: require-corp


    


    Not sure how I would this in my JS code ?

    


    Would love to hear what you guys think.