Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (55)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

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

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

Sur d’autres sites (8393)

  • getting Missing opening '(' after keyword error in ffmpeg loop command

    3 mai 2022, par vivofen578

    How can I run this command that runs in Linux in Windows 10 powershell for ffmpeg ?

    


    for file in D:\input\*.mkv; do ffmpeg -i "$file" -map 0:v:0 -map 0:a:0 -map 0:a:1 -map 0:s:0 -map 0:s:1 -c:v copy -c:a flac -c:s copy D:\output; done


    


    I tried

    


    for file in D:\input\*.mkv; do ./ffmpeg -i "$file" -map 0:v:0 -map 0:a:0 -map 0:a:1 -map 0:s:0 -map 0:s:1 -c:v copy -c:a flac -c:s copy D:\output; done


    


    But I get this error :

    


    At line:1 char:4
+ for file in D:\input\*.mkv; do ./ffmpeg -i "$fil ...
+    ~
Missing opening '(' after keyword 'for'.
At line:1 char:52
+ for file in D:\input\*.mkv; do ./ffmpeg -i "$fil ...
+                                                    ~
Missing statement body in do loop.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingOpenParenthesisAfterKeyword


    


    So how can I change this command to run properly in Windows 10 powershell ?

    


  • Converting to mp4 with ffmpeg takes too much time

    19 octobre 2022, par rwehresmann

    I have a cloud function where I'm trying to convert small octet-stream (captured from the webcam) to mp4 videos, however, it takes a huge amount of time to convert even a small stream (112.17 KB). I cannot finish the conversion below the timeout of 500 seconds in my cloud function.

    


    Here is my node server :

    


    #!/usr/bin/env node

const express = require('express')
const app = express()
const router = express.Router()
const func = require('./index')
const bodyParser = require('body-parser')

app.use(bodyParser.raw({ type: 'application/octet-stream' }))
router.post('/transcoder', func.transcode)
router.options('/transcoder', func.transcode)
app.use('/', router)

// start the server
const port = 3030
const http = require('http')
app.set('port', port)
const server = http.createServer(app)
server.listen(port)


    


    The function that does the conversion :

    


    const functions = require('@google-cloud/functions-framework');
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path
const FfmpegCommand = require('fluent-ffmpeg')
const fs = require('fs')
const path = require('path')
const stream = require('stream')
const cors = require('cors')({ origin: true })

FfmpegCommand.setFfmpegPath(ffmpegPath)

class WritableChunkCache extends stream.Writable {
    constructor(options) {
        super(options)
        this._chunks = []
    }

    write(chunk, encoding, callback) {
        this._chunks.push(chunk)
        if(typeof callback === 'function') callback()
    }

    writev(chunks, callback) {
        this._chunks = this._chunks.concat(chunks)
        if(typeof callback === 'function') callback()
    }

    get buffer(){
        return Buffer.concat(this._chunks)
    }
}

functions.http('mp4Transcoder', (req, res) => {
   try {
    res.set('Access-Control-Allow-Origin', '*');
    res.set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
    res.set('Access-Control-Allow-Headers', 'Content-Type');
    res.set('Access-Control-Allow-Credentials', true);

    if (req.method === 'OPTIONS') {
        res.set('Access-Control-Allow-Origin', '*');
        res.set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
        res.set('Access-Control-Allow-Headers', 'Content-Type');
        res.set('Access-Control-Allow-Credentials', true);
        res.status(204).send('');
    } else {
      cors(req, res, () => {});

      // for compatibility between dev-server and live cloud function
      if (!req.rawBody) {
        req.rawBody = req.body
      }

      if (req.rawBody) {
        const readStream = new stream.PassThrough()
        readStream.end(req.rawBody)
        const outStream = new WritableChunkCache()

        const command = new FfmpegCommand(readStream)
            .on('end', () => {
              console.log("Finished transcoding.")
              res.send(outStream.buffer)
             })
            .on('error', (err, ...args) => {
              console.error(err, args)
              res.status(500).send(err)
            })
            .format('mp4')
            .outputOptions(['-movflags frag_keyframe+empty_moov'])
            .pipe(outStream, { end: true })
      } else {
        res.status(400).send("No video file sent.")
      }
    }
  } catch (e) {
    console.log(e)
    res.status(500).send(e)
  }
});


    


    I'm not concerned with the video quality. Any idea of how could I improve the conversion time ?

    


  • Convert a bash script to Windows bat script [closed]

    17 mai 2024, par gyandoo

    I have a bash script, now I need to convert it to bat.

    


    What the script does is based on the shortcut the script checks the audio codec and video codec using ffprobe and then loops through all the files in the folder to convert the file(s) using the presets based on which one the shortcut calls.

    


    It also limits the processor usage before running ffmpeg.

    


    Here's the script :

    


    #!/bin/sh
FILES="/home/red/Downloads/to_convert/*"
to_convert="/home/red/Downloads/to_convert"
TYPE="$1"
#echo "$TYPE"
if [ -e '/tmp/convert.txt' ]; then
  echo "Ffmpeg is currently converting a file!"
  exit 0
else
if [ "$(ls -A $to_convert)" ];
then
    #Create a temp file so if the script is run hourly and there is an existing instance running the scripts exits
    echo >> '/tmp/convert.txt'
    #iterate through each file in the directory
    for f in $FILES
    do
    FILENAME1=$(basename "$f")
    FILENAME=${FILENAME1%.*}

    
    ##  Detect what audio codec is being used:
    audio=$(ffprobe "$f" 2>&1 | sed -n '/Audio:/s/.*: \([a-zA-Z0-9]*\).*/\1/p' | sed 1q)
    ##  Detect video codec:
    video=$(ffprobe "$f" 2>&1 | sed -n '/Video:/s/.*: \([a-zA-Z0-9]*\).*/\1/p' | sed 1q)
    ##  Set default audio settings (you may need to use a different encoder,
    ##  since libfdk_aac is not re-distributable)
    aopts="-c:a libfdk_aac -vbr 3"
    ##  Set default video settings:
    vopts="-c:v libx264 -crf 22 -preset veryfast"

    case "$audio" in
        aac|mp3 )
    #If the audio is one of the MP4-supported codecs,
    #copy the stream instead of transcoding
            aopts="-c:a copy"
            ;;
        "" )
    #If there is no audio stream, don't bother with audio
            aopts="-an"
            ;;
        * )
            ;;
    esac

    case "$video" in
    #If the video stream is one of the MP4-compatible formats,
    #copy the stream
        h264|mpeg4|mpeg2video|mpeg1video )
            vopts="-c:v copy"
            ;;
        "" )
    #If no video stream is detected, don't bother with video
            vopts="-vn"
            ;;
        * )
            ;;
    esac

    
    if [ "$TYPE" = "shrink" ]; then
    
      taskset -c 0,2 ffmpeg -i "$f" -vcodec libx265 -crf 28 -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

    elif [ "$TYPE" = "phone" ]; then

      taskset -c 0,2 ffmpeg -y -i "$f" -vf scale=640:-2 -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

    elif [ "$TYPE" = "pmv" ]; then

      taskset -c 0,2 ffmpeg -y -i "$f" -vf scale=360:-2 -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1      

    elif [ "$TYPE" = "music" ]; then

      taskset -c 0,2 ffmpeg -i "$f" -acodec libmp3lame "/home/red/Downloads/done/""$FILENAME"".mp3" && success=0 || success=1  

    elif [ "$TYPE" = "audio-boost" ]; then

      taskset -c 0,2 ffmpeg -i "$f" -vcodec copy -af "volume=10dB" "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

    elif [ "$TYPE" = "burn-first-sub" ]; then  

      taskset -c 0,2 ffmpeg -i "$f" -vf "subtitles=""$f"":si=0'" "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

    elif [ "$TYPE" = "burn-srt" ]; then  

      taskset -c 0,2 ffmpeg -i "$f" -vf "subtitles=/home/red/Downloads/to_convert/""$FILENAME"".srt" "/home/huckleberry/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

    elif [ "$TYPE" = "audio-track2" ]; then  

      taskset -c 0,2 ffmpeg -y -i "$f" -map 0:v -map 0:a:1 $vopts $aopts -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

    elif [ "$TYPE" = "split" ]; then  

      taskset -c 0,2 MP4Box -splits 1996800 "$f" && success=0 || success=1

    elif [ "$TYPE" = "fix" ]; then  
      taskset -c 0,2 ffmpeg -y -i "$f" -map 0:v:0 -map 0:a:0 -vcodec libx264 -acodec aac -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

    else    

      taskset -c 0,2 ffmpeg -y -i "$f" -map 0:v -map 0:a:0 $vopts $aopts -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

      TYPE="converted"

    fi

    
    if [ $success -eq 0 ]; then
        swaks --header Subject:"${TYPE} - ${FILENAME}" --body "${FILENAME}" -S
        echo "Removing $f file..."
        rm "$f"
    else
        swaks --header Subject:"failed - ${FILENAME}" --body "${FILENAME}" -S
        echo "process failed"
    fi    
   
    done
    
    #remove the temp file created
    rm "/tmp/convert.txt"
    exit 0
else
    echo "to_convert folder is empty"
    exit 0
fi
exit 0
fi