Recherche avancée

Médias (16)

Mot : - Tags -/mp3

Autres articles (53)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (7402)

  • FFMPEG, want to encode 720x480 and automatically scale to 640x480 or 854x480 as necessary depending on the ratio

    2 décembre 2023, par boxylogan

    EDIT : See appended notes at the bottom of the post.

    


    Note : all MKVs are sourced from my original Farscape Starburst DVDs, MPEG2.
I've been slowly re-encoding my old TV shows into a crisper format and I have for some shows, mainly extras (but also full episodes) MKVs that are a mix of 4:3 and 16:9. Usually I open the files up in Mediainfo and find out which ones are 4:3, stick them in one folder to encode in 640x480, then the same with 16:9. It's worked fine for the umpteen amount of times I've had to encode my shows.
I would like to try to expedite the process with a single FFMPEG command that can automatically detect if the files are 4:3 or 16:9 and encode them properly to 640x480 or 854x480.

    


    My main FFMPEG commands have been these two, depending on which aspect ratio I'm using :

    


    854x480p

    


    `for i in *.mkv; do ffmpeg -i "$i" -c:v libx264 -profile:v main -level:v 4.0 -crf 20 -c:a copy -map 0 -vf scale=854:480,setdar=16/9 encoded/"${i%.mkv}.mkv"; done


    


    640x480p

    


    `for i in *.mkv; do ffmpeg -i "$i" -c:v libx264 -profile:v main -level:v 4.0 -crf 20 -c:a copy -map 0 -vf scale=640:480,setdar=4/3 encoded/"${i%.mkv}.mkv"; done


    


    These two have worked fine lately since I got away from the extraneous -x264-params nonsense I picked up years ago. Again, I'm trying to streamline. I found this command a day ago and it SEEMED to look PERFECT :

    


    `for i in *.mkv; do ffmpeg -i "$i" -c:v libx264 -profile:v main -level:v 4.0 -crf 20 -c:a copy -map 0 -vf scale=w='if(gt(dar,854/480),min(854,iw*sar),2*trunc(iw*sar*oh/ih/2))':h='if(gt(dar,854/480),2*trunc(ih*ow/iw/sar/2),min(480,ih))' encoded/"${i%.mkv}.mkv"; done


    


    Looks perfect and works great for 640x480. The only problem is that it returns 852x480, every time. I even tried a modification I found where you set the setsar=1 AFTER the scale filter, and it does nothing.

    


    These are the first warnings I get when I try to run the command, with a 16:9 video, but it still completes :

    


    `[Parsed_scale_0 @ 0x56299c22fcc0] Circular references detected for width 'if(gt(dar, 854/480), min(854,iw*sar), 2*trunc(iw*sar*oh/ih/2))' and height 'if(gt(dar, 854/480), 2*trunc(ih*ow/iw/sar/2), min(480,ih))' - possibly invalid.
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[Parsed_scale_0 @ 0x56299c20e5c0] Circular references detected for width 'if(gt(dar, 854/480), min(854,iw*sar), 2*trunc(iw*sar*oh/ih/2))' and height 'if(gt(dar, 854/480), 2*trunc(ih*ow/iw/sar/2), min(480,ih))' - possibly invalid.


    


    It encodes and I can see the resolution it outputs to :

    


    `Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p(tv, top coded first (swapped)), 852x480 [SAR 1:1 DAR 71:40], q=2-31, 29.97 fps, 1k tbn


    


    The next video is a 4:3 video and gives these warnings, however the video still completes, this time the video encodes properly to 640x480 :your text

    


    `[Parsed_scale_0 @ 0x5623084d4140] Circular references detected for width 'if(gt(dar, 854/480), min(854,iw*sar), 2*trunc(iw*sar*oh/ih/2))' and height 'if(gt(dar, 854/480), 2*trunc(ih*ow/iw/sar/2), min(480,ih))' - possibly invalid.
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)`your text`
Press [q] to stop, [?] for help
[Parsed_scale_0 @ 0x5623084d7080] Circular references detected for width 'if(gt(dar, 854/480), min(854,iw*sar), 2*trunc(iw*sar*oh/ih/2))' and height 'if(gt(dar, 854/480), 2*trunc(ih*ow/iw/sar/2), min(480,ih))' - possibly invalid.


    


    The output details :

    


    `Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p(tv, top coded first (swapped)), 640x48 [SAR 1:1 `your text`DAR 4:3], q=2-31, 29.97 fps, 1k tbn


    


    TL ;DR

    


    EDIT : The actual problem is that the command is encoding the 16:9 aspect ratio files to 852x480 instead of 854x480. 854x480 is actually what I would like. 640x480 for the 4:3 is fine. Apologies, for the lack of clarification.

    


    Videos encode (from original Farscape Starburst DVDs MPEG2) properly to libx264 640x480 for 4:3 but not to 854x480 for 16:9. 16:9 instead encodes to 852x480, despite what command is telling it to do.

    


    Advice ? Thanks in advance ! Anything to make my re-encoding a little bit less tedious. I've been googling for hours and searching, but nothing seems to make it click. Thank you again !

    


  • How can upload audio on dropbox after converted it from the video format using ffmpeg in nodejs and angular

    21 septembre 2021, par Amir Shahzad

    nodejs server side code

    


    This is my nodejs server side where i want to convert the video into the audio format and then want to upload the converted audio on the dropbox is there any way to do that ??

    


    const express = require('express'),
path = require('path'),
cors = require('cors'),
ffmpeg = require('fluent-ffmpeg'),
fs = require("fs"),
access_token = "My-Access-Token";

ffmpeg.setFfmpegPath('/usr/bin/ffmpeg');

const app = express();
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({
  extended: false
}));


app.post('/api/upload', upload.single('mp4'), function (req, res) {
  if (!req.file) {
    console.log("No file is available!");
    return res.send({
     success: false
  });

  } else {
   function convert(input, output, callback) {
      ffmpeg(input)
          .output(output)
          .on('end', function() {                    
           console.log('conversion ended');
            callback(null);
          }).on('error', function(err){
           console.log('error: ', err);
            callback(err);
          }).run();
    }
     const filepath = req.file.path;
     var content = fs.readFileSync(filepath);

 options = {
    method: "POST",
    url: 'https://content.dropboxapi.com/2/files/upload',
    headers: {
     "Content-Type": "text/plain; charset=dropbox-cors-hack" ,
     "Authorization": "Bearer " + access_token,
      "Dropbox-API-Arg": "{\"path\": \"/youtube- 
       radio/"+req.file.originalname+"\",\"mode\": \"overwrite\",\"autorename\": 
       true,\"mute\": false}",
    },
     body:content
};
convert(filepath,  options+'.mp3', function(err,res, body){
   if(!err) {
    console.log('File Name is',req.file.originalname);
    console.log('File Path Is = ',req.file.path)
    console.log('conversion complete');   
    console.log('ERR', err);
   }
});
console.log('File is available!');
return res.send({
  success: true
})
}
 });


  const PORT = process.env.PORT || 8080;
  const server = app.listen(PORT, () => {
  console.log('Connected to port ' + PORT)
  })


    


    i have read many documentations of dropbox and ffmpeg and angular file upload but i could not understand Please anyone can resolve my code Thanks in advance

    


    This is my typescript file

    


    import { Component, OnInit } from '@angular/core';
import { FileUploader } from 'ng2-file-upload';
import { ToastrService } from 'ngx-toastr';
import { Track } from 'ngx-audio-player'; 
import { PlayerServiceService } from './services/player-service.service';


const URL = 'http://localhost:8080/api/upload';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{

public uploader: FileUploader = new FileUploader({
  url: URL,
  itemAlias: 'mp4'
});
 constructor(private toastr: ToastrService,
    private playerService: PlayerServiceService) { }

 ngOnInit(): void {
   this.uploader.onAfterAddingFile = (file) => {
     file.withCredentials = false;
 };
  this.uploader.onCompleteItem = (item: any, status: any) => {
    console.log('Uploaded File Details:', item);
     this.toastr.success('File successfully uploaded!');
  };

}
}


    


    This is html code

    


     <div class="container mt-5">&#xA;  <div class="file-upload">&#xA;     <input type="file" ng2fileselect="ng2fileselect" />&#xA;     <button type="button" class="btn btn-info">&#xA;      Upload&#xA;    </button>&#xA;  </div>&#xA;</div>&#xA;

    &#xA;

  • Render Multiple Gifs with ffplay/ffmpeg in Winform

    17 juin 2019, par Purqs

    I’m trying to get x number of animated gifs to render on like a Panel or PictureBox and using transparency that is in each gif. I’ve tried a couple approaches but am not super famiular with ffmpeg and such. Below is some code that I use to get it to render inside a panel, but I can’t figure out how to get like 5 gifs to stack/layer on one another and still render as you would expect.

    I need/want this to render in the form and not outputted. I am a little confused to why the ffplay.exe doesn’t use the -i command and that might be why i can’t get it to render. any ideas ?

    Working example below.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Diagnostics;
    using System.Threading;
    using System.IO;
    using System.Reflection;
    using System.Runtime.InteropServices;
    using System.Drawing.Text;
    using System.Text.RegularExpressions;
    using System.Configuration;
    using Microsoft.Win32;
    using System.Windows.Forms.VisualStyles;

    //FOR THIS EXAMPLE CREATE FORM HAVE BUTTON ON IT AND PANEL.
    //button: button's click is "button1_Click"
    //panel: Needed to output the render on it.
    //FILES:
    //Test.Gif
    //These ff files came from the ffmpeg offical site.
    //ffplay.exe //currently using
    //ffmpeg.exe //thinking i need to use to get it how I want.
    //I most of the code below from https://stackoverflow.com/questions/31465630/ffplay-successfully-moved-inside-my-winform-how-to-set-it-borderless which was a good starting point.

    namespace Test_Form
    {
       public partial class Form1 : Form
       {
           [DllImport("user32.dll", SetLastError = true)]
           private static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);

           [DllImport("user32.dll")]
           private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);


           //Process ffplay = null;

           public Form1()
           {
               InitializeComponent();
               Application.EnableVisualStyles();
               this.DoubleBuffered = true;
           }



           public Process ffplay = new Process();
           private void FFplay()
           {
               ffplay.StartInfo.FileName = "ffplay.exe";
               ffplay.StartInfo.Arguments = "-noborder Test.gif"; //THIS IS WHERE I INPUT THE GIF FILE
               ffplay.StartInfo.CreateNoWindow = true;
               ffplay.StartInfo.RedirectStandardOutput = true;
               ffplay.StartInfo.UseShellExecute = false;

               ffplay.EnableRaisingEvents = true;
               ffplay.OutputDataReceived += (o, e) => Debug.WriteLine(e.Data ?? "NULL", "ffplay");
               ffplay.ErrorDataReceived += (o, e) => Debug.WriteLine(e.Data ?? "NULL", "ffplay");
               ffplay.Exited += (o, e) => Debug.WriteLine("Exited", "ffplay");
               ffplay.Start();

               Thread.Sleep(1000); // you need to wait/check the process started, then...

               // child, new parent
               // make 'this' the parent of ffmpeg (presuming you are in scope of a Form or Control)
               SetParent(ffplay.MainWindowHandle, this.Handle);

               // window, x, y, width, height, repaint
               // move the ffplayer window to the top-left corner and set the size to 320x280
               MoveWindow(ffplay.MainWindowHandle, 800, 600, 320, 280, true);

               SetParent(ffplay.MainWindowHandle, this.panel1.Handle);
               MoveWindow(ffplay.MainWindowHandle, -5, -30, 320, 280, true);
           }

    //runs the FFplay Command
    private void button1_Click(object sender, EventArgs e)
           {
               FFplay();

           }

           private void Form1_FormClosed(object sender, FormClosedEventArgs e)
           {
               try { ffplay.Kill(); }
               catch { }
           }
       }

    I would like the button to allow me to add any number of gifs (like 5 or 10) all to the same area and have them being animated with their transparent showing what is under that gif.

    So for example I could have a circle image, then a spinning/loading transparent gif on top, and then a gif that counts up/down on top of that one to give me the effect of a count-down.

    Thanks for all the help !