Recherche avancée

Médias (91)

Autres articles (10)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

Sur d’autres sites (2275)

  • FFMPEG:Merging Audio(.mp3) and single image convert them into a Video

    5 juin 2013, par Nitish Singla

    I want to merge IMAGE + AUDIO and convert them into video using FFMPEG library,i compiled the library successfully,and got libfmpeg.so.but getting problem to execute the ffmpeg command through java code.This is command which i am using...
    "ffmpeg -i image8.jpg -i file.m4a -acodec copy test.mp4"
    if i execute this ffmpeg command through CMD,my video.mp4 file is successfully created,but if exceute same command through my Activity,it doesnot create any file.

    MY CODE IS :

    public class Mpeg extends Activity

    static {

       System.loadLibrary("ffmpeg");

    }

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

    File mf = Environment.getExternalStorageDirectory() ;

       String livestream = mf.getAbsoluteFile()+"smile.png";

       String folderpth = mf.getAbsoluteFile()+"RABBA.MP3";

       //String output="/home/saicomputer/game.mp4";

       String output = new File(Environment.getExternalStorageDirectory(), "video.mp4").getAbsolutePath();
       Log.i("Test", "Let's set output to " + output);

       String cmd="ffmpeg -i "+ livestream +" -i "+ folderpth +" -acodec copy "+ output;

        Log.e("chck plzzzzz", "after "+ cmd);

       //String jaiho="ffmpeg -i image8.jpg -i file.m4a -acodec copy test.mp4";

       try{

       Process p = Runtime.getRuntime().exec(cmd);

       }
    catch(Exception e)
    {
       System.out.println("exception"+e);
    }
    enter code here
    CONSOLE OUTPUT-
    06-05 17:58:11.466: E/image(1189): imageeeeeeeee /mnt/sdcard/smile.png
    06-05 17:58:11.466: E/Test(1189): songggggggggg /mnt/sdcard/RABBA.MP3
    06-05 17:58:11.476: E/Test(1189): outputttttt /mnt/sdcard/video.mp4
    06-05 17:58:11.476: E/chck plzzzzz(1189): after ffmpeg -i /mnt/sdcard/smile.png -i      /mnt/sdcard/RABBA.MP3 -acodec copy /mnt/sdcard/video.mp4

    enter code here
    06-05 17:58:10.686: D/dalvikvm(1189): Trying to load lib /data/data/com.example.myfmpeg /lib/libffmpeg.so 0x412a5cf0
    06-05 17:58:10.756: I/dalvikvm(1189): threadid=3: reacting to signal 3
    06-05 17:58:10.955: D/dalvikvm(1189): Added shared lib /data/data/com.example.myfmpeg/lib/libffmpeg.so 0x412a5cf0
    06-05 17:58:10.955: D/dalvikvm(1189): No JNI_OnLoad found in /data/data/com.example.myfmpeg/lib/libffmpeg.so 0x412a5cf0, skipping init
    06-05 17:58:11.024: I/dalvikvm(1189): Wrote stack traces to '/data/anr/traces.txt'
    06-05 17:58:11.215: I/dalvikvm(1189): threadid=3: reacting to signal 3
    06-05 17:58:11.326: I/dalvikvm(1189): Wrote stack traces to '/data/anr/traces.txt'
    06-05 17:58:11.466: E/image(1189): imageeeeeeeee /mnt/sdcard/smile.png
    06-05 17:58:11.466: E/Test(1189): songggggggggg /mnt/sdcard/RABBA.MP3
    06-05 17:58:11.476: E/Test(1189): outputttttt /mnt/sdcard/video.mp4
    06-05 17:58:11.476: E/chck plzzzzz(1189): after ffmpeg -i /mnt/sdcard/smile.png -i /mnt/sdcard/RABBA.MP3 -acodec copy /mnt/sdcard/video.mp4
    0 6-05 17:58:11.896: E/AndroidRuntime(1189): FATAL EXCEPTION: main
    06-05 17:58:11.896: E/AndroidRuntime(1189): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myfmpeg/com.example.myfmpeg.Mpeg}: java.lang.RuntimeException: java.io.IOException: Error running exec(). Command: [ffmpeg, -i, /mnt/sdcard/smile.png, -i, /mnt/sdcard/RABBA.MP3, -acodec, copy, /mnt/sdcard/video.mp4] Working Directory: null Environment: null
    06-05 17:58:11.896: E/AndroidRuntime(1189):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
    06-05 17:58:11.896: E/AndroidRuntime(1189):     at
    06-05 17:58:11.896: E/AndroidRuntime(1189): Caused by: java.lang.RuntimeException: java.io.IOException: Error running exec(). Command: [ffmpeg, -i, /mnt/sdcard/smile.png, -i, /mnt/sdcard/RABBA.MP3, -acodec, copy, /mnt/sdcard/video.mp4] Working Directory: null       Environment: null
  • JavaCV record video in Android

    11 janvier 2017, par wyx

    I want to record video quiet and without preview in Android. So I choice MediaRecorder but I could record only without preview but what make me crazy is that when MediaRecorder start or stop it will with a sound dee.... I try many methods about that . But I think it perhaps sth related to the OS of the mobile. So I try JavaCV because I also want to have a Live function in my app.

    But JavaCV spent me to too much time to solve some strange problems because it’s my first time to do sth about C++ src and video.

    Just compile group: 'org.bytedeco', name: 'javacv-platform', version: '1.3' as the README.md ,I even can’t build my apk.

    Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
    > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/bytedeco/javacpp/macosx-x86_64/libusb-1.0.dylib
       File1: /Users/wyx/.gradle/caches/modules-2/files-2.1/org.bytedeco.javacpp-presets/libfreenect/0.5.3-1.3/736d65a3ef042258429d8e7742128c411806b432/libfreenect-0.5.3-1.3-macosx-x86_64.jar
       File2: /Users/wyx/.gradle/caches/modules-2/files-2.1/org.bytedeco.javacpp-presets/libdc1394/2.2.4-1.3/f1498dacc46162ab68faeb8d66cf02b96fe41c61/libdc1394-2.2.4-1.3-macosx-x86_64.jar

    And then I modified it according this issuse
    use this to repalce. It can build the apk. But the can’t run.

     android {
      ..............
       packagingOptions {
           exclude 'META-INF/services/javax.annotation.processing.Processor'
           pickFirst  'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
           pickFirst  'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
           pickFirst  'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
           pickFirst  'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
       }
    }

    dependencies {
       compile group: 'org.bytedeco', name: 'javacv', version: '1.3'
       compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-x86'
       compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-arm'
       compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.1.0-1.3', classifier: 'android-x86'
       compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.1.0-1.3', classifier: 'android-arm'
    }

    My demo code VideoService which will invoke in MainActivity

    package com.fs.fs.api;

    import com.fs.fs.App;
    import com.fs.fs.utils.DateUtils;
    import com.fs.fs.utils.FileUtils;

    import org.bytedeco.javacpp.avcodec;
    import org.bytedeco.javacv.FFmpegFrameRecorder;
    import org.bytedeco.javacv.FrameRecorder;

    import java.util.Date;

    /**
    * Created by wyx on 2017/1/11.
    */
    public class VideoService {
       private FFmpegFrameRecorder mFrameRecorder;
       private String path;

       private VideoService() {
       }

       private static class SingletonHolder {
           private static final VideoService INSTANCE = new VideoService();
       }

       public static VideoService getInstance() {
           return SingletonHolder.INSTANCE;
       }

       public void startRecordVideo() {
           String fileName = String.format("%s.%s", DateUtils.date2String(new Date(), "yyyyMMdd_HHmmss"), "mp4");
           path = FileUtils.getExternalFullPath(App.getInstance(), fileName);
           mFrameRecorder = new FFmpegFrameRecorder(path, 640, 480, 1);
           mFrameRecorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
           mFrameRecorder.setVideoOption("tune", "zerolatency");
           mFrameRecorder.setVideoOption("preset", "ultrafast");
           mFrameRecorder.setVideoOption("crf", "28");
           mFrameRecorder.setVideoBitrate(300 * 1000);
           mFrameRecorder.setFormat("mp4");

           mFrameRecorder.setFrameRate(30);
           mFrameRecorder.setAudioOption("crf", "0");
           mFrameRecorder.setSampleRate(48 * 1000);
           mFrameRecorder.setAudioBitrate(960 * 1000);
           mFrameRecorder.setAudioCodec(avcodec.AV_CODEC_ID_AAC);
           try {
               mFrameRecorder.start();
           } catch (FrameRecorder.Exception e) {
               e.printStackTrace();
           }
       }

       public void stop() {
           if (mFrameRecorder != null) {
               try {
                   mFrameRecorder.stop();
                   mFrameRecorder.release();
               } catch (FrameRecorder.Exception e) {
                   e.printStackTrace();
               }
               mFrameRecorder = null;
           }
       }

    }

    MainActivity

    package com.fs.fs.activity;

    import android.app.Activity;
    import android.os.Bundle;

    import com.fs.fs.R;
    import com.fs.fs.api.VideoService;

    import static java.lang.Thread.sleep;


    public class MainActivity extends Activity {

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


           VideoService.getInstance().startRecordVideo();
           try {
               sleep(10 * 1000);
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
           VideoService.getInstance().stop();
       }
    }

    Error which make me want to cry.

    E/AndroidRuntime: FATAL EXCEPTION: main
                     Process: com.fs.fs, PID: 30259
                     java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
                         at org.bytedeco.javacpp.Loader.load(Loader.java:590)
                         at org.bytedeco.javacpp.Loader.load(Loader.java:530)
                         at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1694)
                         at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)
                         at com.fs.fs.api.VideoService.startRecordVideo(VideoService.java:34)
                         at com.fs.fs.activity.MainActivity.onCreate(MainActivity.java:75)
                         at android.app.Activity.performCreate(Activity.java:5304)
                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2331)
                         at android.app.ActivityThread.access$1000(ActivityThread.java:143)
                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
                         at android.os.Handler.dispatchMessage(Handler.java:102)
                         at android.os.Looper.loop(Looper.java:136)
                         at android.app.ActivityThread.main(ActivityThread.java:5291)
                         at java.lang.reflect.Method.invokeNative(Native Method)
                         at java.lang.reflect.Method.invoke(Method.java:515)
                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
                         at dalvik.system.NativeStart.main(Native Method)
                      Caused by: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
                         at java.lang.Class.classForName(Native Method)
                         at java.lang.Class.forName(Class.java:251)
                         at org.bytedeco.javacpp.Loader.load(Loader.java:585)
                         at org.bytedeco.javacpp.Loader.load(Loader.java:530) 
                         at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1694) 
                         at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149) 
                         at com.fs.fs.api.VideoService.startRecordVideo(VideoService.java:34) 
                         at com.fs.fs.activity.MainActivity.onCreate(MainActivity.java:75) 
                         at android.app.Activity.performCreate(Activity.java:5304) 
                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090) 
                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245) 
                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2331) 
                         at android.app.ActivityThread.access$1000(ActivityThread.java:143) 
                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244) 
                         at android.os.Handler.dispatchMessage(Handler.java:102) 
                         at android.os.Looper.loop(Looper.java:136) 
                         at android.app.ActivityThread.main(ActivityThread.java:5291) 
                         at java.lang.reflect.Method.invokeNative(Native Method) 
                         at java.lang.reflect.Method.invoke(Method.java:515) 
                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849) 
                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665) 
                         at dalvik.system.NativeStart.main(Native Method) 
                      Caused by: java.lang.NoClassDefFoundError: org/bytedeco/javacpp/avutil
                         at java.lang.Class.classForName(Native Method) 
                         at java.lang.Class.forName(Class.java:251) 
                         at org.bytedeco.javacpp.Loader.load(Loader.java:585) 
                         at org.bytedeco.javacpp.Loader.load(Loader.java:530) 
                         at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1694) 
                         at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149) 
                         at com.fs.fs.api.VideoService.startRecordVideo(VideoService.java:34) 
                         at com.fs.fs.activity.MainActivity.onCreate(MainActivity.java:75) 
                         at android.app.Activity.performCreate(Activity.java:5304) 
                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090) 
                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245) 
                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2331) 
                         at android.app.ActivityThread.access$1000(ActivityThread.java:143) 
                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244) 
                         at android.os.Handler.dispatchMessage(Handler.java:102) 
                         at android.os.Looper.loop(Looper.java:136) 
                         at android.app.ActivityThread.main(ActivityThread.java:5291) 
                         at java.lang.reflect.Method.invokeNative(Native Method) 
                         at java.lang.reflect.Method.invoke(Method.java:515) 
                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849) 
                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665) 
                         at dalvik.system.NativeStart.main(Native Method) 
                      Caused by: java.lang.ClassNotFoundException: Didn't find class "org.bytedeco.javacpp.avutil" on path: DexPathList[[zip file "/data/app/com.fs.fs-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.fs.fs-2, /vendor/lib, /system/lib, /data/datalib]]
                         at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                         at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
                         at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
                         at java.lang.Class.classForName(Native Method) 
                         at java.lang.Class.forName(Class.java:251) 
                         at org.bytedeco.javacpp.Loader.load(Loader.java:585) 
                         at org.bytedeco.javacpp.Loader.load(Loader.java:530) 
                         at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1694) 
                         at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149) 
                         at com.fs.fs.api.VideoService.startRecordVideo(VideoService.java:34) 
                         at com.fs.fs.activity.MainActivity.onCreate(MainActivity.java:75) 
                         at android.app.Activity.performCreate(Activity.java:5304) 
                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090) 
                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245) 
                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2331) 
                         at android.app.ActivityThread.access$1000(ActivityThread.java:143) 
                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244) 
                         at android.os.Handler.dispatchMessage(Handler.java:102) 
                         at android.os.Looper.loop(Looper.java:136) 
                         at android.app.ActivityThread.main(ActivityThread.java:5291) 
                         at java.lang.reflect.Method.invokeNative(Native Method) 
                         at java.lang.reflect.Method.invoke(Method.java:515) 
                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849) 
                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665) 
                         at dalvik.system.NativeStart.main(Native Method) 
    </init></clinit></init></clinit></init></clinit></init></clinit>

    So I want to know a comfortable method to achieve my goal : recode video quiet and without preview. And Live real time ?

    I found ffmpeg4android is a prefect library to run ffmpeg command. I just use it to compress videos from MediaRecorder But I don’t how to do use it to achieve my goal.

  • Read frames from a h264 video in java

    19 octobre 2014, par Shashank Tulsyan

    I am making a tool which records the user’s screen.
    It records almost every activity of the user and saves it as a h264 video.

    I also make a note of the window names.
    Then I make charts out of this data, which tells me how much time the user (me) has spend on what activity. Now I want to take this one level further.
    I want to be able to see the filtered video as well.

    Let’s say, I know I have spend 4 hrs on Netbeans, I also want to see a video showing what all I did on netbeans.

    Some sample video files

    http://neembuu.com/testdir/sat_1413633155981_direct.mkv
    http://neembuu.com/testdir/fri_1413547843213_direct.264

    I am using x264 for encoding.

    These files might be corrupt. Because encoding stops when the user shutsdown the pc or close the program. There is no handling of abrupt program exit. EOF is not written properly. This is a design decision.

    Now the problem is, none of the libraries ( jcodec , h264j ) seem to be able to decode these files.
    I want individual frames.

    Problem with h264j

    • Doesn’t support seeking
    • Randomly doesn’t work for some files, although all files have been created using the same settings ( like the sample fri_1413547843213_direct.264 , h264j doesn’t work with it. )

    Problem with jcodec.

    • Can’t handle mkv
    • Not sure how to use with raw h264 streams (<<< help would be appreciated here, so far I couldn’t find a way to handle raw h264 streams in jcodec )
    • If I used the jcodec’s MP4 muxer ( org.jcodec.samples.mux.AVCMP4Mux ) it does generate a mp4 but it is not able to read the same mp4 which it only generated
    • JCodec handles externally generated mp4 files pretty well. Can seek to any random frame and renders the frame BufferedImage beautifully, but it seems I don’t have my videos in a format which jcodec can handle.

    The encoding settings which I am using.

    x264 - --keyint 240 --sar 1:1 --output "destinationFile" --stitchable --fps 1/1 --input-res 1280x800 --input-csp rgb

    Any tip/advice. How can I make this work ?
    Thanks :D

    Ref : This question is in continuation of this How to make video from images using Java + x264 ; cross platform solution required