Recherche avancée

Médias (0)

Mot : - Tags -/organisation

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

Autres articles (37)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

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

  • Utilisation et configuration du script

    19 janvier 2011, par

    Informations spécifiques à la distribution Debian
    Si vous utilisez cette distribution, vous devrez activer les dépôts "debian-multimedia" comme expliqué ici :
    Depuis la version 0.3.1 du script, le dépôt peut être automatiquement activé à la suite d’une question.
    Récupération du script
    Le script d’installation peut être récupéré de deux manières différentes.
    Via svn en utilisant la commande pour récupérer le code source à jour :
    svn co (...)

Sur d’autres sites (5472)

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

    


  • I want help in making video collage, tried everything but unsuccessful

    16 mars 2016, par Haider Ali

    I want to make Video Collage in which 2 or more videos should be displayed in one frame and then they can be converted into one Video file.
    I tried examples but they just add videos at the end of each video to make a long one combine video.
    Any Help Please

    String FILE_PATH = "/storage/sdcard0/testing.mp4";
    String FILE_PATH2 = "/storage/sdcard0/testing1.mp4";
    String FILE_PATH3 = "/storage/sdcard0/testing2.mp4";
    File file1 = new File(FILE_PATH);
    File file2 = new File(FILE_PATH2);
    File file3 = new File(FILE_PATH3);

    private ProgressDialog pDialog;
    ImageView img,img2,img3;
    MediaMetadataRetriever retriever2 = new MediaMetadataRetriever();
    MediaMetadataRetriever retriever3 = new MediaMetadataRetriever();
    ArrayList<bitmap> bitmapArray1 = new ArrayList<bitmap>();
    ArrayList<bitmap> bitmapArray2 = new ArrayList<bitmap>();
    ArrayList<bitmap> bitmapArray3 = new ArrayList<bitmap>();
    File ScreenDIR = new File("/sdcard/Screens/");
    </bitmap></bitmap></bitmap></bitmap></bitmap></bitmap>

    // have the object build the directory structure, if needed.

    double id1=0,id2=0,id3=0;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);
       ScreenDIR.mkdirs();

        img = (ImageView)findViewById(R.id.imageView);
       img2 = (ImageView)findViewById(R.id.imageView2);
       img3 = (ImageView)findViewById(R.id.imageView3);

       new LoadAllProducts().execute();




    }

    class LoadAllProducts extends AsyncTask {

       /**
        * Before starting background thread Show Progress Dialog
        * */
       @Override
       protected void onPreExecute() {
           super.onPreExecute();
           pDialog = new ProgressDialog(MainActivity.this);
           pDialog.setMessage("Extracting Frames. Please wait...");
           pDialog.setIndeterminate(false);
           pDialog.setCancelable(false);
           pDialog.show();
       }

       /**
        * getting All products from url
        * */
       protected String doInBackground(String... args) {
           if(file1.exists()){


               for (long i = 0; i &lt; 5000; i += 1000/14) { // lenms - video length in milliseconds

                   MediaMetadataRetriever retriever = new MediaMetadataRetriever();
                   retriever.setDataSource(file1.toString());

                  // Bitmap bitmap = retriever.getFrameAtTime((i*1000/14), MediaMetadataRetriever.OPTION_CLOSEST_SYNC);

                   saveBitmapToCahche( getResizedBitmap((retriever.getFrameAtTime((i*1000/14), MediaMetadataRetriever.OPTION_CLOSEST_SYNC)), 500) ,String.valueOf(id1));
                   id1++;
                   //bitmapArray1.add(bitmap);

                  /* File file = new File(ScreenDIR, "sketchpad1" + id1 + ".png");
                   FileOutputStream fOut = null;
                   try {
                       fOut = new FileOutputStream(file);
                   } catch (FileNotFoundException e) {
                       e.printStackTrace();
                   }

                   //bitmap.compress(Bitmap.CompressFormat.PNG, 30, fOut);

                   try {
                       fOut.flush();
                   } catch (IOException e) {
                       e.printStackTrace();
                   }
                   try {
                       fOut.close();


                   } catch (IOException e) {
                       e.printStackTrace();
                   }*/
               }

               }
          /* if(file2.exists()){
               retriever2.setDataSource(file2.toString());
               for (long i = 0; i &lt; 3000; i += 1000/24) { // lenms - video length in milliseconds
                   bitmap2 = retriever2.getFrameAtTime(i*1000/29, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);
                   //bitmapArray2.add(bitmap2);

                   File file = new File(ScreenDIR, "sketchpad2" + id2 + ".png");
                   FileOutputStream fOut = null;
                   try {
                       fOut = new FileOutputStream(file);
                   } catch (FileNotFoundException e) {
                       e.printStackTrace();
                   }

                   bitmap2.compress(Bitmap.CompressFormat.PNG, 85, fOut);
                   try {
                       fOut.flush();
                   } catch (IOException e) {
                       e.printStackTrace();
                   }
                   try {
                       fOut.close();
                       id2++;
                   } catch (IOException e) {
                       e.printStackTrace();
                   }
               }



           }
           if(file3.exists()){
               retriever3.setDataSource(file3.toString());
               for (long i = 0; i &lt; 3000; i += 1000/24) { // lenms - video length in milliseconds
                   bitmap3 = retriever3.getFrameAtTime(i*1000/29, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);
                  // bitmapArray3.add(bitmap3);

                   File file = new File(ScreenDIR, "sketchpad3" + id3 + ".png");
                   FileOutputStream fOut = null;
                   try {
                       fOut = new FileOutputStream(file);
                   } catch (FileNotFoundException e) {
                       e.printStackTrace();
                   }

                   bitmap3.compress(Bitmap.CompressFormat.PNG, 85, fOut);
                   try {
                       fOut.flush();
                   } catch (IOException e) {
                       e.printStackTrace();
                   }
                   try {
                       fOut.close();
                       id3++;
                   } catch (IOException e) {
                       e.printStackTrace();
                   }
               }

               }*/




           return null;
       }
       /**
        * After completing background task Dismiss the progress dialog
        * **/
       protected void onPostExecute(String file_url) {
           // dismiss the dialog after getting all products
           pDialog.dismiss();



           img.setImageBitmap(retrieveBitmapFromCache(String.valueOf(id2)));
           id2 = 50;

           img2.setImageBitmap(retrieveBitmapFromCache(String.valueOf(id2)));
           id2 = 69;

           img3.setImageBitmap(retrieveBitmapFromCache(String.valueOf(id2)));


          // img2.setImageBitmap(bitmapArray2.get(0));
          // img3.setImageBitmap(bitmapArray3.get(0));

           }




       }


    public void saveBitmapToCahche(Bitmap bb,String ID ){

       Cache.getInstance().getLru().put(ID, bb);


    }
    public Bitmap retrieveBitmapFromCache(String ID) {


       Bitmap bitmap = (Bitmap) Cache.getInstance().getLru().get(ID);

       return  bitmap;

    }
    public Bitmap getResizedBitmap(Bitmap image, int maxSize) {
       int width = image.getWidth();
       int height = image.getHeight();

       float bitmapRatio = (float)width / (float) height;
       if (bitmapRatio > 0) {
           width = maxSize;
           height = (int) (width / bitmapRatio);
       } else {
           height = maxSize;
           width = (int) (height * bitmapRatio);
       }
       return Bitmap.createScaledBitmap(image, width, height, true);
    }
    }

    `

  • FFMPEG - Scrambled Output converting from VOB with ffmpeg

    24 décembre 2013, par MattD

    I've concatenated a series of VOB files from a DVD into a single VOB file and I am trying to convert it to MP4 or other similar format. I see a lot of errors when converting and the output appears scrambled.

    >ffmpeg.exe" -i file.vob -sameq file.mp4
    FFmpeg version git-N-29181-ga304071, Copyright (c) 2000-2011 the FFmpeg develope
    rs
     built on Apr 18 2011 21:24:03 with gcc 4.5.2
     configuration: --enable-gpl --enable-version3 --enable-runtime-cpudetect --ena
    ble-memalign-hack --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
    pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
    enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
    --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl
    e-libx264 --enable-libxavs --enable-libxvid --enable-zlib --cross-prefix=i686-w6
    4-mingw32- --target-os=mingw32 --arch=x86_32 --extra-cflags=-I/home/kyle/softwar
    e/ffmpeg/external-libraries/win32/include --extra-ldflags=-L/home/kyle/software/
    ffmpeg/external-libraries/win32/lib --pkg-config=pkg-config
     libavutil    50. 40. 1 / 50. 40. 1
     libavcodec   52.120. 0 / 52.120. 0
     libavformat  52.108. 0 / 52.108. 0
     libavdevice  52.  4. 0 / 52.  4. 0
     libavfilter   1. 79. 0 /  1. 79. 0
     libswscale    0. 13. 0 /  0. 13. 0
    [mpeg2video @ 01751A90] ac-tex damaged at 5 16
    [mpeg2video @ 01751A90] invalid mb type in I Frame at 0 1
    [mpeg2video @ 01751A90] invalid mb type in I Frame at 0 2
    [mpeg2video @ 01751A90] invalid mb type in I Frame at 0 3
    [mpeg2video @ 01751A90] invalid mb type in I Frame at 0 4

    [...]

    I'm guessing this is CSS scrambling and I need to do some sort of DeCSS. Does FFMpeg have an option for this ? Cringe if you'd like, but is there C# source to achieve this ?

    My end goal is really just to get some DVDs that I own onto my media server. I've tried a few demo-ware products with limited success including Acala DVD Ripper, Click to Disk, AVIDemux to name a few. I even paid for a couple of them to get the full version, but Acala only works for about half of my DVDs and Click to Disk can decode the VOB, but I need to use FFMpeg to convert. I'd like to have it all in one app that works and I am willing to write some code for it.