Recherche avancée

Médias (0)

Mot : - Tags -/diogene

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

Autres articles (36)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (4009)

  • H.264 and VP8 for still image coding : WebP ?

    1er octobre 2010, par Dark Shikari — H.264, VP8, google, psychovisual optimizations

    JPEG is a very old lossy image format. By today’s standards, it’s awful compression-wise : practically every video format since the days of MPEG-2 has been able to tie or beat JPEG at its own game. The reasons people haven’t switched to something more modern practically always boil down to a simple one — it’s just not worth the hassle. Even if JPEG can be beaten by a factor of 2, convincing the entire world to change image formats after 20 years is nigh impossible. Furthermore, JPEG is fast, simple, and practically guaranteed to be free of any intellectual property worries. It’s been tried before : JPEG-2000 first, then Microsoft’s JPEG XR, both tried to unseat JPEG. Neither got much of anywhere.

    Now Google is trying to dump yet another image format on us, “WebP”. But really, it’s just a VP8 intra frame. There are some obvious practical problems with this new image format in comparison to JPEG ; it doesn’t even support all of JPEG’s features, let alone many of the much-wanted features JPEG was missing (alpha channel support, lossless support). It only supports 4:2:0 chroma subsampling, while JPEG can handle 4:2:2 and 4:4:4. Google doesn’t seem interested in adding any of these features either.

    But let’s get to the meat and see how these encoders stack up on compressing still images. As I explained in my original analysis, VP8 has the advantage of H.264′s intra prediction, which is one of the primary reasons why H.264 has such an advantage in intra compression. It only has i4x4 and i16x16 modes, not i8x8, so it’s not quite as fancy as H.264′s, but it comes close.

    The test files are all around 155KB ; download them for the exact filesizes. For all three, I did a binary search of quality levels to get the file sizes close. For x264, I encoded with --tune stillimage --preset placebo. For libvpx, I encoded with --best. For JPEG, I encoded with ffmpeg, then applied jpgcrush, a lossless jpeg compressor. I suspect there are better JPEG encoders out there than ffmpeg ; if you have one, feel free to test it and post the results. The source image is the 200th frame of Parkjoy, from derf’s page (fun fact : this video was shot here ! More info on the video here.).

    Files : (x264 [154KB], vp8 [155KB], jpg [156KB])

    Results (decoded to PNG) : (x264, vp8, jpg)

    This seems rather embarrassing for libvpx. Personally I think VP8 looks by far the worst of the bunch, despite JPEG’s blocking. What’s going on here ? VP8 certainly has better entropy coding than JPEG does (by far !). It has better intra prediction (JPEG has just DC prediction). How could VP8 look worse ? Let’s investigate.

    VP8 uses a 4×4 transform, which tends to blur and lose more detail than JPEG’s 8×8 transform. But that alone certainly isn’t enough to create such a dramatic difference. Let’s investigate a hypothesis — that the problem is that libvpx is optimizing for PSNR and ignoring psychovisual considerations when encoding the image… I’ll encode with --tune psnr --preset placebo in x264, turning off all psy optimizations. 

    Files : (x264, optimized for PSNR [154KB]) [Note for the technical people : because adaptive quantization is off, to get the filesize on target I had to use a CQM here.]

    Results (decoded to PNG) : (x264, optimized for PSNR)

    What a blur ! Only somewhat better than VP8, and still worse than JPEG. And that’s using the same encoder and the same level of analysis — the only thing done differently is dropping the psy optimizations. Thus we come back to the conclusion I’ve made over and over on this blog — the encoder matters more than the video format, and good psy optimizations are more important than anything else for compression. libvpx, a much more powerful encoder than ffmpeg’s jpeg encoder, loses because it tries too hard to optimize for PSNR.

    These results raise an obvious question — is Google nuts ? I could understand the push for “WebP” if it was better than JPEG. And sure, technically as a file format it is, and an encoder could be made for it that’s better than JPEG. But note the word “could”. Why announce it now when libvpx is still such an awful encoder ? You’d have to be nuts to try to replace JPEG with this blurry mess as-is. Now, I don’t expect libvpx to be able to compete with x264, the best encoder in the world — but surely it should be able to beat an image format released in 1992 ?

    Earth to Google : make the encoder good first, then promote it as better than the alternatives. The reverse doesn’t work quite as well.

    [155KB]
  • swresample/resample : speed up Blackman Nuttall filter

    9 novembre 2015, par Ganesh Ajjanagadde
    swresample/resample : speed up Blackman Nuttall filter
    

    This may be a slightly surprising optimization, but is actually based on
    an understanding of how math libraries compute trigonometric functions.
    Explanation is given here so that future development uses libm more effectively
    across the codebase.

    All libm’s essentially compute transcendental functions via some kind of
    polynomial approximation, be it Taylor-Maclaurin or Chebyshev.
    Correction terms are added via polynomial correction factors when needed
    to squeeze out the last bits of accuracy. Lookup tables are also
    inserted strategically.

    In the case of trigonometric functions, periodicity is exploited via
    first doing a range reduction to an interval around zero, and then using
    some polynomial approximation.

    This range reduction is the most natural way of doing things - else one
    would need polynomials for ranges in different periods which makes no
    sense whatsoever.

    To avoid the need for the range reduction, it is helpful to feed in
    arguments as close to the origin as possible for the trigonometric
    functions. In fact, this also makes sense from an accuracy point of view :
    IEEE floating point has far more resolution for small numbers than big ones.

    This patch does this for the Blackman-Nuttall filter, and yields a
    non-negligible speedup.

    Sample benchmark (x86-64, Haswell, GNU/Linux)
    test : fate-swr-resample-dblp-2626-44100
    old :
    18893514 decicycles in build_filter (loop 1000), 256 runs, 0 skips
    18599863 decicycles in build_filter (loop 1000), 512 runs, 0 skips
    18445574 decicycles in build_filter (loop 1000), 1000 runs, 24 skips

    new :
    16290697 decicycles in build_filter (loop 1000), 256 runs, 0 skips
    16267172 decicycles in build_filter (loop 1000), 512 runs, 0 skips
    16251105 decicycles in build_filter (loop 1000), 1000 runs, 24 skips

    Reviewed-by : Michael Niedermayer <michael@niedermayer.cc>
    Signed-off-by : Ganesh Ajjanagadde <gajjanagadde@gmail.com>

    • [DH] libswresample/resample.c
  • How to Make Video from Arraylist of images with Music

    6 avril 2018, par hardik sojitra

    I am making an app which makes video from selected images which is stored in SD card I have implement the
    group : ’com.github.hiteshsondhi88.libffmpeg’, name : ’FFmpegAndroid’, version : ’0.2.5’ this library and make this classes but it does not work

    Utility.java

    public class Utility {
       private final static String TAG = Utility.class.getName();
       private static Context mContext;
       public Utility(Context context) {
           mContext = context;
       }
       public static String excuteCommand(String command)
       {
           try {
               Log.d(TAG, "execute command : " + command);

               Process process = Runtime.getRuntime().exec(command);

               BufferedReader reader = new BufferedReader(
                       new InputStreamReader(process.getInputStream()));
               int read;
               char[] buffer = new char[4096];
               StringBuffer output = new StringBuffer();
               while ((read = reader.read(buffer)) > 0) {
                   output.append(buffer, 0, read);
               }
               reader.close();
               process.waitFor();
               Log.d(TAG, "command result: " + output.toString());
               return output.toString();
           } catch (IOException e) {
               Log.e(TAG, e.getMessage(), e);
           } catch (InterruptedException e) {
               Log.e(TAG, e.getMessage(), e);
           }
           return "";
       }
       public String getPathOfAppInternalStorage()
       {
           return Environment.getExternalStorageDirectory().getAbsolutePath();
       }
       public void saveFileToAppInternalStorage(InputStream inputStream, String fileName)
       {
           File file = new File(getPathOfAppInternalStorage() + "/" + fileName);
           if (file.exists())
           {
               Log.d(TAG, "SaveRawToAppDir Delete Exsisted File");
               file.delete();
           }
           FileOutputStream outputStream;
           try {
               outputStream = mContext.openFileOutput(fileName, Context.MODE_PRIVATE);
               byte[] buffer = new byte[1024];
               int length;
               while ((length = inputStream.read(buffer)) > 0)
               {
                   outputStream.write(buffer, 0, length);
               }
               outputStream.close();
               inputStream.close();
           } catch (Exception e) {
               Log.e(TAG, e.getMessage(), e);
           }
       }
       public static boolean isFileExsisted(String filePath)
       {
           File file = new File(filePath);
           return file.exists();
       }
       public static void deleteFileAtPath(String filePath)
       {
           File file = new File(filePath);
           file.delete();
       }
    }

    enter image description here

    ffmpegController.java

    package com.example.admin.imagetovideowithnative;

    import android.content.Context;
    import android.util.Log;

    import java.io.ByteArrayInputStream;
    import java.io.InputStream;

    public class FfmpegController {
       private static Context mContext;
       private static Utility mUtility;
       private static String mFfmpegBinaryPath;
       public FfmpegController(Context context) {
           mContext = context;
           mUtility = new Utility(context);
           initFfmpeg();
       }
       private void initFfmpeg()
       {
           mFfmpegBinaryPath = mContext.getApplicationContext().getFilesDir().getAbsolutePath() + "/ffmpeg";
           if (Utility.isFileExsisted(mFfmpegBinaryPath))
               return;
           InputStream inputStream = mContext.getResources().openRawResource(R.raw.ffmpeg);
           mUtility.saveFileToAppInternalStorage(inputStream, "ffmpeg");
           Utility.excuteCommand(CommandHelper.commandChangeFilePermissionForExecuting(mFfmpegBinaryPath));
       }
       public void convertImageToVideo(String inputImgPath)
       {
           Log.e("Image Parth", "inputImgPath - "+inputImgPath);
           if (Utility.isFileExsisted(pathOuputVideo()))
               Utility.deleteFileAtPath(pathOuputVideo());
           saveShellCommandImg2VideoToAppDir(inputImgPath);
           Utility.excuteCommand("sh" + " " + pathShellScriptImg2Video());
       }
       public String pathOuputVideo()
       {
           return mUtility.getPathOfAppInternalStorage() + "/out.mp4";
       }
       private String pathShellScriptImg2Video()
       {
           return mUtility.getPathOfAppInternalStorage() + "/img2video.sh";
       }
       private void saveShellCommandImg2VideoToAppDir(String inputImgPath)
       {
           String command = CommandHelper.commandConvertImgToVideo(mFfmpegBinaryPath, inputImgPath, pathOuputVideo());
           InputStream is = new ByteArrayInputStream(command.getBytes());
           mUtility.saveFileToAppInternalStorage(is, "img2video.sh");
       }
    }

    CommandHelper.java

    package com.example.admin.imagetovideowithnative;

    import android.util.Log;

    public class CommandHelper {
       public static String commandConvertImgToVideo(String ffmpegBinaryPath, String inputImgPath, String outputVideoPath) {
           Log.e("ffmpegBinaryPath", "ffmpegBinaryPath - " + ffmpegBinaryPath);
           Log.e("inputImgPath", "inputImgPath - " + inputImgPath);
           Log.e("outputVideoPath", "outputVideoPath - " + outputVideoPath);

           return ffmpegBinaryPath + " -r 1/1 -i " + inputImgPath + " -c:v libx264 -crf 23 -pix_fmt yuv420p -s 640x480 " + outputVideoPath;
       }

       public static String commandChangeFilePermissionForExecuting(String filePath) {
           return "chmod 777 " + filePath;
       }
    }

    AsynckTask

    class Asynck extends AsyncTask {

           FfmpegController mFfmpegController = new FfmpegController(PhotosActivity.this);
           Utility mUtility = new Utility(PhotosActivity.this);

           @Override
           protected void onPreExecute() {
               super.onPreExecute();
               Log.e("Video Process Start", "======================== Video Process Start ======================================");

           }

           @Override
           protected Void doInBackground(Object... objects) {
               mFfmpegController.convertImageToVideo("");
               return null;
           }

           @Override
           protected void onPostExecute(Void aVoid) {
               super.onPostExecute(aVoid);
               Log.e("Video Process Complete", "======================== Video Process Complete ======================================");
               Log.e("Video Path", "Path - " + mFfmpegController.pathOuputVideo());
               Toast.makeText(PhotosActivity.this, "Video Process Complete", Toast.LENGTH_LONG).show();
           }
       }