Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (111)

  • Emballe Médias : Mettre en ligne simplement des documents

    29 octobre 2010, par

    Le plugin emballe médias a été développé principalement pour la distribution mediaSPIP mais est également utilisé dans d’autres projets proches comme géodiversité par exemple. Plugins nécessaires et compatibles
    Pour fonctionner ce plugin nécessite que d’autres plugins soient installés : CFG Saisies SPIP Bonux Diogène swfupload jqueryui
    D’autres plugins peuvent être utilisés en complément afin d’améliorer ses capacités : Ancres douces Légendes photo_infos spipmotion (...)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

Sur d’autres sites (9950)

  • FFmpeg audio formats : ipod vs mov (for ALAC)

    22 juillet 2022, par Fabien Snauwaert

    In converting to Apple Lossless (ALAC) using FFmpeg, I have two options :

    


    ffmpeg -y -i whatever.wav -b:a 256k -ar 16000 -ac 1 -f ipod -acodec:a alac whatever.ipod.m4a
# Output #0, ipod, to 'content/tests/comparing-codecs/whatever.ipod.m4a':

ffmpeg -y -i whatever.wav -b:a 256k -ar 16000 -ac 1 -f mov -acodec:a alac whatever.mov.m4a
# Output #0, mov, to 'content/tests/comparing-codecs/whatever.mov.m4a':


    


    (I could also leave the -f alone, which the defaults to ipod.)

    


    This results in near identical files, from ffprobe :

    


    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'content/tests/comparing-codecs/whatever.ipod.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: isomiso2
    encoder         : Lavf58.29.100
  Duration: 00:00:01.46, start: 0.000000, bitrate: 67 kb/s
    Stream #0:0(und): Audio: alac (alac / 0x63616C61), 16000 Hz, mono, s16p, 63 kb/s (default)
    Metadata:
      handler_name    : SoundHandler


    


    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'content/tests/comparing-codecs/whatever.mov.m4a':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.29.100
  Duration: 00:00:01.46, start: 0.000000, bitrate: 67 kb/s
    Stream #0:0: Audio: alac (alac / 0x63616C61), 16000 Hz, mono, s16p, 63 kb/s (default)
    Metadata:
      handler_name    : SoundHandler


    


    Only the file size is slightly different, with the ipod file 43 bytes smaller.

    


    I'm able to play both files in on macOS and iPhone, at least on the devices I had access to.

    


    My question is : is there any practical difference between formats ? Is a given format preferable for a specific use ?

    


  • iOS SDK avcodec_decode_video Optimization

    6 août 2013, par Johny Cage

    I've recently started a project that relies on streaming FLV directly to an iOS device. As most famous i went with ffmpeg (and an iOS wrapper - kxmovie). To my surprise iPhone 4 is incapable of playing even SD low-bitrate FLV videos. The current implementation i'm using is decoding the video/audio/sub frames in dispatch_async while loop and copies the YUV frame data to a object, where the object is parsed to 3 textures - Y/U/V (in case of RGB color space - just parse the data) and rendered on screen. After much trial and error, i've decided to kill the whole rendering pipeline and leave only the avcodec_decode_video2 function to run. Surprisingly the FPS did not improve and videos are still unplayable.

    My question is : What can i do to improve the performance of avcodec_decode_video2 ?

    Note :
    I've tried a few commercial apps and they play the same file perfectly fine with no more than 50-60% cpu usage.

    The library is based off the 1.2 branch and this is are the build args :

    '--arch=arm',
    '--cpu=cortex-a8',
    '--enable-pic',
    "--extra-cflags='-arch armv7'",
    "--extra-ldflags='-arch armv7'",
    "--extra-cflags='-mfpu=neon -mfloat-abi=softfp -mvectorize-with-neon-quad'",
    '--enable-neon',
    '--enable-optimizations',
    '--disable-debug',
    '--disable-armv5te',
    '--disable-armv6',
    '--disable-armv6t2',
    '--enable-small',
    '--disable-ffmpeg',
    '--disable-ffplay',
    '--disable-ffserver',
    '--disable-ffprobe',
    '--disable-doc',
    '--disable-bzlib',
    '--target-os=darwin',
    '--enable-cross-compile',
    #'--enable-nonfree',
    '--enable-gpl',
    '--enable-version3',

    And according to Instruments the following functions take about 30% CPU usage each :

    Running Time    Self        Symbol Name
    37023.9ms   32.3%   13874,8                   ff_h264_decode_mb_cabac
    34626.2ms   30.2%   9194,7                    loop_filter
    29430.0ms   25.6%   173,8                     ff_h264_hl_decode_mb
  • Use C# to converting apng to webm with ffmpeg from pipe input and output

    30 novembre 2022, par martin wang

    I was using ffmpeg to convert Line sticker from apng file to webm file.
And the result is weird, some of them was converted successed and some of them failed.
not sure what happend with these failed convert.

    


    Here is my c# code to convert Line sticker to webm,
and I use CliWrap to run ffmpeg command line.

    


    async Task Main()
{

    var downloadUrl = @"http://dl.stickershop.LINE.naver.jp/products/0/0/1/23303/iphone/stickerpack@2x.zip";
    var arg = @$"-i pipe:.png -vf scale=512:512:force_original_aspect_ratio=decrease:flags=lanczos -pix_fmt yuva420p -c:v libvpx-vp9 -cpu-used 5 -minrate 50k -b:v 350k -maxrate 450k -to 00:00:02.900 -an -y -f webm pipe:1";

    var errorCount = 0;
    try
    {
        using (var hc = new HttpClient())
        {
            var imgsZip = await hc.GetStreamAsync(downloadUrl);

            using (ZipArchive zipFile = new ZipArchive(imgsZip))
            {
                var files = zipFile.Entries.Where(entry => Regex.IsMatch(entry.FullName, @"animation@2x\/\d+\@2x.png"));
                foreach (var entry in files)
                {
                    try
                    {
                        using (var fileStream = File.Create(Path.Combine("D:", "Projects", "ffmpeg", "Temp", $"{Path.GetFileNameWithoutExtension(entry.Name)}.webm")))
                        using (var pngFileStream = File.Create(Path.Combine("D:", "Projects", "ffmpeg", "Temp", $"{entry.Name}")))
                        using (var entryStream = entry.Open())
                        using (MemoryStream ms = new MemoryStream())
                        {
                            entry.Open().CopyTo(pngFileStream);

                            var result = await Cli.Wrap("ffmpeg")
                                         .WithArguments(arg)
                                         .WithStandardInputPipe(PipeSource.FromStream(entryStream))
                                         .WithStandardOutputPipe(PipeTarget.ToStream(ms))
                                         .WithStandardErrorPipe(PipeTarget.ToFile(Path.Combine("D:", "Projects", "ffmpeg", "Temp", $"{Path.GetFileNameWithoutExtension(entry.Name)}Info.txt")))
                                         .WithValidation(CommandResultValidation.ZeroExitCode)
                                         .ExecuteAsync();
                            ms.Seek(0, SeekOrigin.Begin);
                            ms.WriteTo(fileStream);
                        }
                    }
                    catch (Exception ex)
                    {
                        entry.FullName.Dump();
                        ex.Dump();
                        errorCount++;
                    }
                }
            }

        }
    }
    catch (Exception ex)
    {
        ex.Dump();
    }
    $"Error Count:{errorCount.Dump()}".Dump();

}


    


    This is the failed convert file's error information from ffmpeg :

    


    enter image description here

    


    And the successed convert file from ffmpeg infromation :
enter image description here

    


    It's strange when I was manually converted these failed convert file from command line, and it will be converted successed.
enter image description here

    


    The question is the resource of images are all the same apng file,
so I just can't understan why some of files will convert failed from my c# code
but also when I manually use command line will be converted successed ?

    



    


    I have written same exampe from C# to Python...
and here is python code :

    


    from io import BytesIO
import os
import re
import subprocess
import zipfile

import requests


downloadUrl = "http://dl.stickershop.LINE.naver.jp/products/0/0/1/23303/iphone/stickerpack@2x.zip"
args = [
    'ffmpeg',
    '-i', 'pipe:',
    '-vf', 'scale=512:512:force_original_aspect_ratio=decrease:flags=lanczos',
    '-pix_fmt', 'yuva420p',
    '-c:v', 'libvpx-vp9',
    '-cpu-used', '5',
    '-minrate', '50k',
    '-b:v', '350k',
    '-maxrate', '450k', '-to', '00:00:02.900', '-an', '-y', '-f', 'webm', 'pipe:1'
]


imgsZip = requests.get(downloadUrl)
with zipfile.ZipFile(BytesIO(imgsZip.content)) as archive:
    files = [file for file in archive.infolist() if re.match(
        "animation@2x\/\d+\@2x.png", file.filename)]
    for entry in files:
        fileName = entry.filename.replace(
            "animation@2x/", "").replace(".png", "")
        rootPath = 'D:\\' + os.path.join("Projects", "ffmpeg", "Temp")
        # original file
        apngFile = os.path.join(rootPath, fileName+'.png')
        # output file
        webmFile = os.path.join(rootPath, fileName+'.webm')
        # output info
        infoFile = os.path.join(rootPath, fileName+'info.txt')

        with archive.open(entry) as file, open(apngFile, 'wb') as output_apng, open(webmFile, 'wb') as output_webm, open(infoFile, 'wb') as output_info:
            p = subprocess.Popen(args, stdin=subprocess.PIPE,
                                 stdout=subprocess.PIPE, stderr=output_info)
            outputBytes = p.communicate(input=file.read())[0]

            output_webm.write(outputBytes)
            file.seek(0)
            output_apng.write(file.read())



    


    And you can try it,the result will be the as same as C#.