Recherche avancée

Médias (0)

Mot : - Tags -/metadatas

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (53)

  • Librairies et logiciels spécifiques aux médias

    10 décembre 2010, par

    Pour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
    Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

Sur d’autres sites (6883)

  • Fade out in ffmpeg when creating a video from a still image is wonky ?

    13 juin 2017, par Matt W

    I’m creating a video that :

    • uses a still image as a source
    • has a text overlay
    • fades in and out
    • has a silent stereo audio track.

    So far, I have this, and it (almost) works correctly :

    ffmpeg -f lavfi -i "aevalsrc=0|0" -loop 1 -i turtle-2.jpg  -c:v libx264 -t 5 -r 30 -s 1920x1080 -aspect 16:9 -pix_fmt yuv420p -filter:v drawtext="fontsize=130:fontfile=comic.ttf:text='hello world':x=(w-text_w)*.25:y=(h-text_h)*.75",fade=in:0:60,fade=out:90:60 -acodec aac turtle11.mp4

    The only problem is that the fade out doesn’t seem to be going to black, even tho this is a 150 frame video and I believe I am following the ffmpeg documentation correctly.

    The resulting video is here :

    http://video.blivenyc.com/vid-from-image/turtle11.mp4

    Any thoughts ?

  • How to decode mp3 to raw sample data for FFMpeg using FFMediaToolkit

    28 décembre 2022, par Lee

    My objective is to create a video slideshow with audio using a database as the source. The final implementation video and audio inputs need to be memory streams or byte arrays, not a file system path. The sample code is file based for portability. It's just trying to read a file based mp3 then write it to the output.

    


    I've tried a few FFMpeg wrappers and I'm open to alternatives. This code is using FFMediaToolkit. The video portion of the code works. It's the audio that I can't get to work.

    


    The input is described as "A 2D jagged array of multi-channel sample data with NumChannels rows and NumSamples columns." The datatype is float[][].

    


    My mp3 source is mono. I'm using NAudio.Wave to decode the mp3. It is then split into chunks equal to the frame size for the sample rate. It is then converted into the jagged float with the data on channel 0.

    


    The FFMpeg decoder displays a long list of "buffer underflow" and "packet too large, ignoring buffer limits to mux it". C# returns "Specified argument was out of the range of valid values." The offending line of code being "file.Audio.AddFrame(frameAudio)".

    


    The source is 16 bit samples. The PCM_S16BE codec is the only one that I could get to accept 16 bit sample format. I could only get the MP3 encoder to work with "Signed 32-bit integer (planar)" as the sample format. I'm not certain if the source data needs to be converted from 16 to 32 bit to use the codec.

    


    `

    


    using FFMediaToolkit;
using FFMediaToolkit.Decoding;
using FFMediaToolkit.Encoding;
using FFMediaToolkit.Graphics;
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FFMediaToolkit.Audio;
using NAudio.Wave;
using FFmpeg.AutoGen;

    internal class FFMediaToolkitTest
    {
        const int frameRate = 30;
        const int vWidth = 1920;
        const int vHeight = 1080;
        const int aSampleRate = 24_000; // source sample rate
        //const int aSampleRate = 44_100;
        const int aSamplesPerFrame = aSampleRate / frameRate;
        const int aBitRate = 32_000;
        const string dirInput = @"D:\Websites\Vocabulary\Videos\source\";
        const string pathOutput = @"D:\Websites\Vocabulary\Videos\example.mpg";

        public FFMediaToolkitTest()
        {
            try
            {
                FFmpegLoader.FFmpegPath = ".";  //  FFMpeg  DLLs in root project directory
                var settings = new VideoEncoderSettings(width: vWidth, height: vHeight, framerate: frameRate, codec: VideoCodec.H264);
                settings.EncoderPreset = EncoderPreset.Fast;
                settings.CRF = 17;

                //var settingsAudio = new AudioEncoderSettings(aSampleRate, 1, (AudioCodec)AVCodecID.AV_CODEC_ID_PCM_S16BE);  // Won't run with low bitrate.
                var settingsAudio = new AudioEncoderSettings(aSampleRate, 1, AudioCodec.MP3); // mpg runs with SampleFormat.SignedDWordP
                settingsAudio.Bitrate = aBitRate;
                //settingsAudio.SamplesPerFrame = aSamplesPerFrame;
                settingsAudio.SampleFormat = SampleFormat.SignedDWordP;

                using (var file = MediaBuilder.CreateContainer(pathOutput).WithVideo(settings).WithAudio(settingsAudio).Create())
                {
                    var files = Directory.GetFiles(dirInput, "*.jpg");
                    foreach (var inputFile in files)
                    {
                        Console.WriteLine(inputFile);
                        var binInputFile = File.ReadAllBytes(inputFile);
                        var memInput = new MemoryStream(binInputFile);
                        var bitmap = Bitmap.FromStream(memInput) as Bitmap;
                        var rect = new System.Drawing.Rectangle(System.Drawing.Point.Empty, bitmap.Size);
                        var bitLock = bitmap.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
                        var bitmapData = ImageData.FromPointer(bitLock.Scan0, ImagePixelFormat.Bgr24, bitmap.Size);

                        for (int i = 0; i < 60; i++)
                            file.Video.AddFrame(bitmapData); 
                        bitmap.UnlockBits(bitLock);
                    }

                    var mp3files = Directory.GetFiles(dirInput, "*.mp3");
                    foreach (var inputFile in mp3files)
                    {
                        Console.WriteLine(inputFile);
                        var binInputFile = File.ReadAllBytes(inputFile);
                        var memInput = new MemoryStream(binInputFile);

                        foreach (float[][] frameAudio in GetFrames(memInput))
                        {
                            file.Audio.AddFrame(frameAudio); // encode the frame
                        }
                    }
                    //Console.WriteLine(file.Audio.CurrentDuration);
                    Console.WriteLine(file.Video.CurrentDuration);
                    Console.WriteLine(file.Video.Configuration);
                }
            }
            catch (Exception e)
            {
                Vocab.LogError("FFMediaToolkitTest", e.StackTrace + " " + e.Message);
                Console.WriteLine(e.StackTrace + " " + e.Message);
            }

            Console.WriteLine();
            Console.WriteLine("Done");
            Console.ReadLine();
        }


        public static List GetFrames(MemoryStream mp3stream)
        {
            List output = new List();
            
            int frameCount = 0;

            NAudio.Wave.StreamMediaFoundationReader smfReader = new StreamMediaFoundationReader(mp3stream);
            Console.WriteLine(smfReader.WaveFormat);
            Console.WriteLine(smfReader.WaveFormat.AverageBytesPerSecond); //48000
            Console.WriteLine(smfReader.WaveFormat.BitsPerSample);  // 16
            Console.WriteLine(smfReader.WaveFormat.Channels);  // 1 
            Console.WriteLine(smfReader.WaveFormat.SampleRate);     //24000

            Console.WriteLine("PCM bytes: " + smfReader.Length);
            Console.WriteLine("Total Time: " + smfReader.TotalTime);

            int samplesPerFrame = smfReader.WaveFormat.SampleRate / frameRate;
            int bytesPerFrame = samplesPerFrame * smfReader.WaveFormat.BitsPerSample / 8;
            byte[] byteBuffer = new byte[bytesPerFrame];

            while (smfReader.Read(byteBuffer, 0, bytesPerFrame) != 0)
            {
                float[][] buffer = Convert16BitToFloat(byteBuffer);
                output.Add(buffer);
                frameCount++;
            }
            return output;
        }

        public static float[][] Convert16BitToFloat(byte[] input)
        {
            // Only works with single channel data
            int inputSamples = input.Length / 2;
            float[][] output = new float[1][]; 
            output[0] = new float[inputSamples];
            int outputIndex = 0;
            for (int n = 0; n < inputSamples; n++)
            {
                short sample = BitConverter.ToInt16(input, n * 2);
                output[0][outputIndex++] = sample / 32768f;
            }
            return output;
        }

    }




    


    `

    


    I've tried multiple codecs with various settings. I couldn't get any of the codecs to accept a mp4 output file extension. FFMpeg will run but error out with mpg as the output file.

    


  • Extracting frames from image in C#

    12 août 2015, par Atom Scott

    I`ve seen some stackover flow on how to do this but i cant get it to work for myself in visual studio.

    What is wrong with code ? I have downloaded FFMpeg and im using it as reference. yet, I get the error

    "Could not load file or assembly Aforge.Video.FFMPEG. dll or one of
    its dependencies"

    Here is the code.

    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 AForge;
    using AForge.Video;
    using AForge.Video.FFMPEG;

    namespace WindowsFormsApplication6
    {
    public partial class Form1 : Form
    {
       public Form1()
       {
           InitializeComponent();
       }

       private void button1_Click(object sender, EventArgs e)
       {
           // create instance of video reader
           VideoFileReader reader = new VideoFileReader( );
           // open video file
           reader.Open( "test.avi" );
           // read 100 video frames out of it
           for ( int i = 0; i < 100; i++ )
           {
           Bitmap videoFrame = reader.ReadVideoFrame( );

           videoFrame.Save(i + ".bmp");

           // dispose the frame when it is no longer required
           videoFrame.Dispose( );
           }
           reader.Close( );
       }
    }
    }

    The program stop when i click the button and comes with an error.