Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (39)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Prérequis à l’installation

    31 janvier 2010, par

    Préambule
    Cet article n’a pas pour but de détailler les installations de ces logiciels mais plutôt de donner des informations sur leur configuration spécifique.
    Avant toute chose SPIPMotion tout comme MediaSPIP est fait pour tourner sur des distributions Linux de type Debian ou dérivées (Ubuntu...). Les documentations de ce site se réfèrent donc à ces distributions. Il est également possible de l’utiliser sur d’autres distributions Linux mais aucune garantie de bon fonctionnement n’est possible.
    Il (...)

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

  • Is there a way to use ffmpeg binary on anroid platform in MAUI project ?

    18 août 2023, par Mrand

    Currently I'm working on my test project about capabilities of MAUI and ffmpeg, so I can create my own applications. I got stuck on problem about using ffmpeg on platforms other than Windows (for example Anroid).

    


    I tried googling the problem, didn't find anything helpful. Right now my ffmpeg for Android binary is situated inside Platforms/Android/Assets/libs as AndroidAsset. And I'm using code below to put my binary on Android to execute in the future

    


    protected override void OnCreate(Bundle bundle)
{
    base.OnCreate(bundle);

    if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != Permission.Granted 
        || ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) != Permission.Granted 
        || ContextCompat.CheckSelfPermission(this, Manifest.Permission.Internet) != Permission.Granted) 
    {
        ActivityCompat.RequestPermissions(this, new string[] {
          Manifest.Permission.ReadExternalStorage, Manifest.Permission.WriteExternalStorage, Manifest.Permission.Internet
        }, 0);
    }

    PrepareFFmpeg();
}

private void PrepareFFmpeg()
{
    var assetManager = Android.App.Application.Context.Assets;
    string path = "libs/ffmpeg";
    string destinationPath = Path.Combine(Android.App.Application.Context.ApplicationInfo.DataDir, "ffmpeg");

    var directoryPath = Path.GetDirectoryName(destinationPath);
    if (!Directory.Exists(directoryPath))
    {
        Directory.CreateDirectory(directoryPath);
    }

    using (var inputStream = assetManager.Open(path))
    {
        if (File.Exists(destinationPath)) 
        {
            File.Delete(destinationPath);
        }

        using (var outputStream = File.Create(destinationPath))
        {
            inputStream.CopyTo(outputStream);
        }
    }

    Java.Lang.JavaSystem.SetProperty("java.io.tmpdir", destinationPath);
    Java.Lang.Runtime.GetRuntime().Exec("chmod 700 " + destinationPath);

    FFmpeg.SetExecutablesPath(destinationPath);
}


    


    public static class FFmpegService
{
    public static async Task ConvertVideoAsync(string inputPath, string outputPath, string format)
    {
        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        {
            string ffmpegPath = GetFFmpegPath();
            string arguments = $"-i \"{inputPath}\" \"{outputPath}.{format}\"";

            ProcessStartInfo startInfo = new ProcessStartInfo
            {
                FileName = ffmpegPath,
                Arguments = arguments,
                RedirectStandardOutput = true,
                RedirectStandardError = true,
                UseShellExecute = false,
                CreateNoWindow = true,
            };

            using Process process = new Process { StartInfo = startInfo };
            process.Start();
            await process.WaitForExitAsync();
        }
        else
        {
            //IConversion conversion = await FFmpeg.Conversions.FromSnippet.Convert(inputPath, $"{outputPath}.{f*-  .ormat}");
            //string command = $"-i {inputPath} -f {format} {outputPath}";

            //ProcessStartInfo psi = new ProcessStartInfo();
            //psi.FileName = FFmpeg.ExecutablesPath;
            //psi.Arguments = command;
            //psi.RedirectStandardOutput = true;
            //psi.RedirectStandardError = true;
            //psi.UseShellExecute = false;

            //Process process = Process.Start(psi);
            //process.WaitForExit();

            //string output = process.StandardOutput.ReadToEnd();
            //string error = process.StandardError.ReadToEnd();

            string outputPathWithFormat = $"{outputPath}.{format}";
            IConversion conversion = await FFmpeg.Conversions.FromSnippet.Convert(inputPath, outputPathWithFormat);
            IConversionResult result = await conversion.Start();
        }
    }

    private static string GetFFmpegPath()
    {
        //string platformFolder = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "Windows" : "Android";
        //return Path.Combine("Platforms", platformFolder, "ffmpeg", "ffmpeg");
        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        {
            return Path.Combine("Platforms", "Windows", "ffmpeg", "ffmpeg");
        }
        else
        {
            return null;
        }
    }
}


    


    I'm trying to use FFmpegService to convert video in any desired format I can by passing it in the arguments of the method (Windows works fine).

    


    In my service I also tried to use Xabe.FFmpeg but it always gives couldn't find part of path (path here). When using more manual approach I face another problem every time : Permission denied.
For path I tried /data/data/APPNAME and cache directories. It always results in problems mentioned above.

    


    I downloaded FFmpeg binary from this repository : https://github.com/tomaszzmuda/Xabe.FFmpeg/releases/tag/executables

    


    My goal is to get conversion working for any format and for at least two platforms : Android and Windows, but if you can tell me how to do it on other platforms as well - I would be grateful.

    


    Additional question : If you can tell me the best practice setting standard path for storing converted audio and video, thanks.

    


    If you need more details, please specify I would happily provide them.
P.S. : don't look at the quality of code, I tried to code this for week so I didn't care about quality, I just want to learn how can I do this.

    


    Thanks for your time and attention !

    


    Project : Maui Blazor .Net 7.0

    


  • lavc : use a separate field for exporting audio encoder padding

    23 août 2014, par Anton Khirnov
    lavc : use a separate field for exporting audio encoder padding
    

    Currently, the amount of padding inserted at the beginning by some audio
    encoders, is exported through AVCodecContext.delay. However
    - the term ’delay’ is heavily overloaded and can have multiple different
    meanings even in the case of audio encoding.
    - this field has entirely different meanings, depending on whether the
    codec context is used for encoding or decoding (and has yet another
    different meaning for video), preventing generic handling of the codec
    context.

    Therefore, add a new field — AVCodecContext.initial_padding. It could
    conceivably be used for decoding as well at a later point.

    • [DH] doc/APIchanges
    • [DH] libavcodec/aacenc.c
    • [DH] libavcodec/ac3enc.c
    • [DH] libavcodec/audio_frame_queue.c
    • [DH] libavcodec/avcodec.h
    • [DH] libavcodec/g722enc.c
    • [DH] libavcodec/libfaac.c
    • [DH] libavcodec/libfdk-aacenc.c
    • [DH] libavcodec/libmp3lame.c
    • [DH] libavcodec/libopencore-amr.c
    • [DH] libavcodec/libopusenc.c
    • [DH] libavcodec/libspeexenc.c
    • [DH] libavcodec/libtwolame.c
    • [DH] libavcodec/libvo-aacenc.c
    • [DH] libavcodec/libvo-amrwbenc.c
    • [DH] libavcodec/libvorbis.c
    • [DH] libavcodec/mpegaudioenc.c
    • [DH] libavcodec/nellymoserenc.c
    • [DH] libavcodec/ra144enc.c
    • [DH] libavcodec/utils.c
    • [DH] libavcodec/version.h
    • [DH] libavcodec/wmaenc.c
  • Transcode each stream in a different thread with ffmpeg

    30 mai 2018, par hedgar2017

    Is there a way of forcing ffmpeg to encode each audio stream in a different thread ?

    ffmpeg
       -i audio1.ac3 -c:a libopus
       -i audio2.ac3 -c:a libopus
       -i audio3.ac3 -c:a libopus
       output.mkv

    I mean only ffmpeg’s own instruments, without multiple processes and other OS features.

    Normally, there is only one core saturated, so encoding a file with many audio streams is very long.

    Exact command :

    ffmpeg -loglevel verbose
       -i 'Ярость (Fury).mkv'
       -i 'Fury (2014) [Ukr & Eng, Sub Eng] BDRip-AVC [Hurtom & HELLYWOOD].mkv'
       -threads 0 -max_muxing_queue_size 65536 -avoid_negative_ts 1 -metadata title=2014.Fury.BDRip.HEVC.1080p
       -map 0:0 -c:v copy -metadata:s:v:0 title=2014.Fury.BDRip.HEVC.1080p -disposition:v:0 +defaug-[forced
       -map 0:2 -c:a libopus -application audio -vbr on -packet_loss 0 -frame_duration 20 -mapping_family 255 -compression_level 10 -metadata:s:a:0 language=eng -metadata:s:a:0 title=Original -disposition:a:0 +defaug-[forced
       -map 1:1 -c:a libopus -application audio -vbr on -packet_loss 0 -frame_duration 20 -mapping_family 255 -compression_level 10 -metadata:s:a:1 language=ukr -disposition:a:1 -default-forced
       -map 0:1 -c:a libopus -application audio -vbr on -packet_loss 0 -frame_duration 20 -mapping_family 255 -compression_level 10 -metadata:s:a:2 language=rus -metadata:s:a:2 title=Dub -disposition:a:2 -default-forced
       -map 0:10 -c:s copy -metadata:s:s:0 language=eng -metadata:s:s:0 title=Original -disposition:s:0 -default-forced
       -f matroska ./2014.Fury.BDRip.HEVC.1080p.mkv

    Log :

    ... inputs ...
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:2 -> #0:1 (dts (dca) -> opus (libopus))
     Stream #1:1 -> #0:2 (ac3 (native) -> opus (libopus))
     Stream #0:1 -> #0:3 (ac3 (native) -> opus (libopus))
     Stream #0:10 -> #0:4 (copy)
    Press [q] to stop, [?] for help
    [graph_2_in_0_1 @ 0000019ca2cb29c0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x60f
    [format_out_0_3 @ 0000019ca2cb20c0] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_3'
    [auto_resampler_0 @ 0000019ca2cb27c0] ch:6 chl:5.1(side) fmt:fltp r:48000Hz -> ch:6 chl:5.1(side) fmt:flt r:48000Hz
    [libopus @ 0000019ca2c9f3c0] No bit rate set. Defaulting to 384000 bps.
    [graph_0_in_0_2 @ 0000019ca2cb1ac0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x60f
    [format_out_0_1 @ 0000019ca2cb1bc0] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
    [auto_resampler_0 @ 0000019ca2cb14c0] ch:6 chl:5.1(side) fmt:fltp r:48000Hz -> ch:6 chl:5.1(side) fmt:flt r:48000Hz
    [libopus @ 0000019ca292c980] No bit rate set. Defaulting to 384000 bps.
    [graph_1_in_1_1 @ 0000019ca2cb2bc0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x60f
    [format_out_0_2 @ 0000019ca2cb26c0] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_2'
    [auto_resampler_0 @ 0000019ca2cb0dc0] ch:6 chl:5.1(side) fmt:fltp r:48000Hz -> ch:6 chl:5.1(side) fmt:flt r:48000Hz
    [libopus @ 0000019ca292e980] No bit rate set. Defaulting to 384000 bps.
    Output #0, matroska, to './2014.Fury.BDRip.HEVC.1080p.mkv':
     Metadata:
       DATE_RELEASED   : 2014
       title           : 2014.Fury.BDRip.HEVC.1080p
       Released by     : Buba5473 for NNM-Club
       Copyright       : Encoded by Goor80
       encoder         : Lavf58.12.100
       Chapter #0:0: start 0.000000, end 478.228000
       Metadata:
         title           : Chapter 01
       ... chapters ...
       Stream #0:0: Video: hevc (Main 10), 1 reference frame, yuv420p10le(tv), 1920x800 (0x0) [SAR 1:1 DAR 12:5], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
       Stream #0:1(eng): Audio: opus (libopus) ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, 5.1(side), flt, delay 312, 384 kb/s (default)
       Stream #0:2(ukr): Audio: opus (libopus) ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, 5.1(side), flt, delay 312, 384 kb/s
       Stream #0:3(rus): Audio: opus (libopus) ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, 5.1(side), flt, delay 312, 384 kb/s
       Stream #0:4(eng): Subtitle: subrip
    [matroska @ 0000019ca2d17f00] Starting new cluster due to timestamp=6175.5kbits/s speed=10.2x
    [matroska @ 0000019ca2d17f00] Starting new cluster due to timestamp=7530.8kbits/s speed=8.74x
    [matroska @ 0000019ca2d17f00] Starting new cluster due to timestamp=7955.1kbits/s speed=9.02x
    frame=156607 fps=205 q=-1.0 size= 8321971kB time=01:48:51.85 bitrate=10437.1kbits/s speed=8.55x
    ... not finished yet ...

    fps is always around 3000/number_of_audio_channels, meaning all audio transcoding is done with the only thread.