Recherche avancée

Médias (91)

Autres articles (54)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (7613)

  • How to add subtitles using FFmpeg-kit ?

    17 novembre 2024, par Mohammed Bekele

    I'm running a Flutter app with Ffmpeg-kit package to burn a subtitle on a video. I have a words list with the timings and map that to generate an srt and ass file, but when executing this it didn't work.

    


    Firstly, here is how I generated the Ass file.

    


    Future<string> _createAssFile() async {&#xA;    String filePath = await getAssOutputFilePath();&#xA;&#xA;    final file = File(filePath);&#xA;    final buffer = StringBuffer();&#xA;&#xA;    // Write ASS headers&#xA;    buffer.writeln(&#x27;[Script Info]&#x27;);&#xA;    buffer.writeln(&#x27;Title: Generated ASS&#x27;);&#xA;    buffer.writeln(&#x27;ScriptType: v4.00&#x2B;&#x27;);&#xA;    buffer.writeln(&#x27;Collisions: Normal&#x27;);&#xA;    buffer.writeln(&#x27;PlayDepth: 0&#x27;);&#xA;    buffer.writeln(&#x27;Timer: 100,0000&#x27;);&#xA;    buffer.writeln(&#x27;[V4&#x2B; Styles]&#x27;);&#xA;    buffer.writeln(&#xA;        &#x27;Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding&#x27;);&#xA;    buffer.writeln(&#xA;        &#x27;Style: Default,Arial,40,&amp;H00FFFFFF,&amp;H000000FF,&amp;H00000000,&amp;H80000000,1,1,1,1,100,100,0,0,1,1,1,2,10,10,10,1&#x27;);&#xA;    buffer.writeln(&#x27;[Events]&#x27;);&#xA;    buffer.writeln(&#xA;        &#x27;Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text&#x27;);&#xA;&#xA;    // Write events (subtitles)&#xA;    for (int i = 0; i &lt; widget.words.length; i&#x2B;&#x2B;) {&#xA;      final word = widget.words[i];&#xA;      final startTime = _formatAssTime(word[&#x27;startTime&#x27;].toDouble());&#xA;      final endTime = _formatAssTime(word[&#x27;endTime&#x27;].toDouble());&#xA;      final text = word[&#x27;word&#x27;];&#xA;&#xA;      buffer.writeln(&#x27;Dialogue: 0,$startTime,$endTime,Default,,0,0,0,,$text&#x27;);&#xA;    }&#xA;&#xA;    await file.writeAsString(buffer.toString());&#xA;    return filePath;&#xA;  }&#xA;&#xA;  String _formatAssTime(double seconds) {&#xA;    final int hours = seconds ~/ 3600;&#xA;    final int minutes = ((seconds % 3600) ~/ 60);&#xA;    final int secs = (seconds % 60).toInt();&#xA;    final int millis = ((seconds - secs) * 1000).toInt() % 1000;&#xA;&#xA;    return &#x27;${hours.toString().padLeft(1, &#x27;0&#x27;)}:${minutes.toString().padLeft(2, &#x27;0&#x27;)}:${secs.toString().padLeft(2, &#x27;0&#x27;)}.${(millis ~/ 10).toString().padLeft(2, &#x27;0&#x27;)}&#x27;;&#xA;  }&#xA;</string>

    &#xA;

    Then I used this command which was the official way of adding ass file to a video.

    &#xA;

      String newCmd = "-i $videoPath -vf ass=$assFilePath -c:a copy $_outputPath";&#xA;

    &#xA;

    Yet when executing this command it did not work. However I changed it to this command

    &#xA;

    String newCmd = "-i $videoPath -i $assFilePath $_outputPath";&#xA;

    &#xA;

    Well, that code works but the styling is not being applied. So I tried yet another command to filter and position the ass file.

    &#xA;

    String newCmd = "-i $videoPath -i $assFilePath -filter_complex \"[0:v][1:s]ass=\\an5:text=&#x27;%{event.text}&#x27;,scale=iw*0.8:ih*0.8,setdar=16/9[outv]\" -map [outv] -c:a copy $_outputPath";&#xA;

    &#xA;

    This made it even worse, because the app crashed when I ran this. Also there is a log for this command before crashing

    &#xA;

    F/libc    (19624): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x19 in tid 21314 (pool-4-thread-7), pid 19624 (ple.caption_app)&#xA;*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***&#xA;Build fingerprint: &#x27;samsung/a15nsxx/a15:14/UP1A.231005.007/A155FXXU1AWKA:user/release-keys&#x27;&#xA;Revision: &#x27;5&#x27;&#xA;ABI: &#x27;arm64&#x27;&#xA;Processor: &#x27;7&#x27;&#xA;Timestamp: 2024-07-10 19:27:40.812476860&#x2B;0300&#xA;Process uptime: 1746s&#xA;Cmdline: com.example.caption_app&#xA;pid: 19624, tid: 21314, name: pool-4-thread-7  >>> com.example.caption_app &lt;&lt;&lt;&#xA;uid: 10377&#xA;tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)&#xA;signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000019&#xA;Cause: null pointer dereference&#xA;    x0  0000000000000001  x1  b400006ec98d8660  x2  0000000000000000  x3  0000000000000002&#xA;    x4  0000006f62d1ea12  x5  b400006e04f745ea  x6  352f35372f64352f  x7  7f7f7f7f7f7f7f7f&#xA;    x8  632ace36577a905e  x9  632ace36577a905e  x10 0000006e191378c0  x11 0000000000000001&#xA;    x12 0000000000000001  x13 0000000000000000  x14 0000000000000004  x15 0000000000000008&#xA;    x16 0000006e27ffa358  x17 0000006e27dbfb00  x18 0000006e00d48000  x19 0000006f62d1f0e8&#xA;    x20 0000006f62d24000  x21 0000006e27ffc5d0  x22 0000006e27ffc5f0  x23 0000000000000000&#xA;    x24 b400006f3f089248  x25 0000006f62d1f220  x26 b400006f3f057b20  x27 0000000000000002&#xA;    x28 0000000000000088  x29 0000006f62d1f100&#xA;    lr  0000006e27dbfb0c  sp  0000006f62d1f0a0  pc  0000006e27dbfb10  pst 0000000060001000&#xA;1 total frames&#xA;backtrace:&#xA;      #00 pc 0000000000121b10  /data/app/~~oWqjrGA2indQhuEw6u_J2A==/com.example.caption_app-u2Ofk54FVtMc5D-i3SLC6g==/base.apk!libavfilter.so (offset 0x10a46000) (avfilter_inout_free&#x2B;16)    &#xA;Lost connection to device.&#xA;

    &#xA;

    I tried the normal command in my local machine on Windows, and this is what I used

    &#xA;

    ffmpeg -i F:\ffmpeg\video.avi -vf subtitles=&#x27;F\:\\ffmpeg\\caption.srt&#x27;:force_style=&#x27;Fontsize=24&#x27; F:\ffmpeg\new.mp4&#xA;

    &#xA;

    As you can see above when subtitles are used it had an extra backslashes for each path and a pre backslash after the partition letter. But I don't know if this does apply for android devices. How can I make sense of this ?

    &#xA;

  • fastest ffmpeg without caring about quality

    31 mai 2019, par RedDeath

    I would like to convert any video into .mp4 as fast as possible without caring about quality loss. I have used the next commands with which I have been able to finish the process in 37 seconds for a 10 second video.

    -vcodec h264
    -crf 32
    -preset ultrafast

    However 37 seconds is still too long for a 10 seconds video. Is there any improvements that I can do to the command in order to reduce the execution time ?


    Edit (Extra info) :

    I’m using FFmpeg Android (implementation 'com.writingminds:FFmpegAndroid:0.3.2') even though commands usually work for any FFmpeg (with a few variants depending on the FFmpeg version).

    The command used in my case which gave me the fastest result so far is :

       mFfmpeg.execute(
           arrayOf(
               "-i" , videoCopy?.path,
               "-vcodec", "h264",
               "-crf", "32",
               "-preset", "ultrafast",
               "-y", uploadFile?.path),
           object : ExecuteBinaryResponseHandler() { ... }

    Which for regular FFmpeg command would be

    "-ffmpeg -i {video?.path} -vcodec h264 -crf 32 -preset ultrafast -y {uploadFile?.path}"

    Where video is my original video File and uploadFile is the File where I want to save the result into.

    In a Samsung J3 (SM-J320M, you can find its specifications online) such command takes the aforementioned 37 seconds.

    After executing such command the first onProgress message returned by FFmpeg prints :

    ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers  built with gcc 4.8 (GCC)  
    configuration:
       --target-os=linux
       --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi-
       --arch=arm
       --cpu=cortex-a8
       --enable-runtime-cpudetect
       --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot
       --enable-pic
       --enable-libx264
       --enable-libass
       --enable-libfreetype
       --enable-libfribidi
       --enable-libmp3lame
       --enable-fontconfig
       --enable-pthreads
       --disable-debug
       --disable-ffserver
       --enable-version3
       --enable-hardcoded-tables
       --disable-ffplay
       --disable-ffprobe
       --enable-gpl
       --enable-yasm
       --disable-doc
       --disable-shared
       --enable-static
       --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config
       --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a
       --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all'
       --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie'
       --extra-libs='-lpng -lexpat -lm'
       --extra-cxxflags=  
           libavutil    55. 17.103 / 55. 17.103  
           libavcodec    57. 24.102 / 57. 24.102
           libavformat    57. 25.100 / 57. 25.100  
           libavdevice    57.  0.101 / 57.  0.101  
           libavfilter    6. 31.100 /  6. 31.100  
           libswscale      4.  0.100 /  4.  0.100  
           libswresample   2.  0.101 /  2.  0.101  
           libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/DCIM/Yakatak/656.mp4':  Metadata:    major_brand     : mp42    minor_version   : 0    compatible_brands: isommp42    creation_time   : 2019-05-29 11:27:56    location        : +51.5202-000.1435/    location-eng    : +51.5202-000.1435/  Duration: 00:00:09.47, start: 0.000000, bitrate: 12147 kb/s    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720, 11899 kb/s, 30.02 fps, 30 tbr, 90k tbn, 180k tbc (default)    Metadata:      rotate          : 90      creation_time   : 2019-05-29 11:27:56      handler_name    : VideoHandle    Side data:      displaymatrix: rotation of -90.00 degrees    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)    Metadata:      creation_time   : 2019-05-29 11:27:56      handler_name    : SoundHandle[libx264 @ 0xb5428800] using cpu capabilities: none![libx264 @ 0xb5428800] profile Constrained Baseline, level 3.1[libx264 @ 0xb5428800] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=32.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0

    Output #0, mp4, to '/storage/emulated/0/DCIM/Yakatak/uploadFile.mp4':  Metadata:    major_brand     : mp42    minor_version   : 0    compatible_brands: isommp42    location-eng    : +51.5202-000.1435/    location        : +51.5202-000.1435/    encoder         : Lavf57.25.100    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x1280, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)    Metadata:      handler_name    : VideoHandle      creation_time   : 2019-05-29 11:27:56      encoder         : Lavc57.24.102 libx264    Side data:      unknown side data type 10 (24 bytes)    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)    Metadata:      creation_time   : 2019-05-29 11:27:56      handler_name    : SoundHandle      encoder         : Lavc57.24.102 aacStream mapping:  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))  Stream #0:1 -> #0:1 (aac (native) -> aac (native))Press [q] to stop, [?] for helpframe=    0 fps=0.0
  • Issue in concatenating two video files using FFMPEG

    12 mai 2014, par intrepidkarthi

    I am trying to concatenate two mp4 files taken from gallery. I am getting issue with process execution failure. I have added the code and the error log. Using the ffmpeg library taken from guardian project.

    I am running this in Samsung Galaxy S3 device.

    The error is thrown in this particular line.

    ProcessBuilder pb = new ProcessBuilder(cmds);
    pb.directory(fileExec);
    Process process = pb.start();  

    When I replace the last line above with this,

    Process process = Runtime.getRuntime().exec("chmod 777 "+cmds.toArray(new String[cmds.size()]));

    It works with out the exception as shown below. But the output doesn’t seem to come.

    File concatenation Code :

       File fileVideoOutput = new File(getApplicationContext()
               .getExternalFilesDir("test") + "hello.mp4");
       fileVideoOutput.delete();

       File fileTmp = getApplicationContext().getCacheDir();
       File fileAppRoot = new File(getApplicationContext()
               .getApplicationInfo().dataDir);

       try {
           FfmpegController fc = new FfmpegController(fileTmp, fileAppRoot);

           ArrayList<clip> listVideos = new ArrayList<clip>();
           Clip clip = new Clip();
           clip.path = video1;
           fc.getInfo(clip);
           clip.duration = clip.duration;
           System.out.println("Clip1 duration " + clip.duration);
           listVideos.add(clip);

           Clip clip2 = new Clip();
           clip2.path = video2;
           fc.getInfo(clip2);
           clip2.duration = clip2.duration;
           System.out.println("Clip2 duration " + clip2.duration);
           listVideos.add(clip2);

           Clip clipOut = new Clip();
           clipOut.path = fileVideoOutput.getCanonicalPath();

           fc.concatAndTrimFilesMP4Stream(listVideos, clipOut, false, false,
                   new ShellUtils.ShellCallback() {

                       @Override
                       public void shellOut(String shellLine) {

                           System.out.println("fc>" + shellLine);
                       }

                       @Override
                       public void processComplete(int exitValue) {

                           if (exitValue &lt; 0)
                               System.err.println("concat non-zero exit: "
                                       + exitValue);
                       }
                   });
       } catch (Exception e1) {
           e1.printStackTrace();
       }
    </clip></clip>

    Error log :

    05-08 11:17:03.765: W/System.err(25209): java.io.IOException: Error running exec(). Command: [ffmpeg, -y, -i, /storage/emulated/0/DCIM/Camera/20140507_155713.mp4, -f, mpegts, -c, copy, -an, -bsf:v, h264_mp4toannexb, /data/data/com.yoyo.videoeditor/cache/0.ts] Working Directory: /data/data/com.yoyo.videoeditor/lib Environment: [VIBE_PIPE_PATH=/dev/pipes, ANDROID_ROOT=/system, EMULATED_STORAGE_SOURCE=/mnt/shell/emulated, LOOP_MOUNTPOINT=/mnt/obb, EMULATED_STORAGE_TARGET=/storage/emulated, ANDROID_BOOTLOGO=1, LD_LIBRARY_PATH=/vendor/lib:/system/lib, EXTERNAL_STORAGE=/storage/emulated/legacy, ANDROID_SOCKET_zygote=9, ANDROID_DATA=/data, PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin, ANDROID_ASSETS=/system/app, ASEC_MOUNTPOINT=/mnt/asec, BOOTCLASSPATH=/system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework2.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/sec_edm.jar:/system/framework/seccamera.jar:/system/framework/scrollpause.jar:/system/framework/stayrotation.jar:/system/framework/smartfaceservice.jar:/system/framework/sc.jar:/system/framework/secocsp.jar:/system/framework/commonimsinterface.jar, ANDROID_PROPERTY_WORKSPACE=8,66560, SECONDARY_STORAGE=/storage/extSdCard:/storage/UsbDriveA:/storage/UsbDriveB:/storage/UsbDriveC:/storage/UsbDriveD:/storage/UsbDriveE:/storage/UsbDriveF, ANDROID_STORAGE=/storage]
    05-08 11:17:03.770: W/System.err(25209):    at java.lang.ProcessManager.exec(ProcessManager.java:211)
    05-08 11:17:03.770: W/System.err(25209):    at java.lang.ProcessBuilder.start(ProcessBuilder.java:195)
    05-08 11:17:03.770: W/System.err(25209):    at org.ffmpeg.android.FfmpegController.execProcess(FfmpegController.java:101)
    05-08 11:17:03.770: W/System.err(25209):    at org.ffmpeg.android.FfmpegController.execFFMPEG(FfmpegController.java:71)
    05-08 11:17:03.770: W/System.err(25209):    at org.ffmpeg.android.FfmpegController.execFFMPEG(FfmpegController.java:75)
    05-08 11:17:03.775: W/System.err(25209):    at org.ffmpeg.android.FfmpegController.convertToMP4Stream(FfmpegController.java:657)
    05-08 11:17:03.775: W/System.err(25209):    at org.ffmpeg.android.FfmpegController.concatAndTrimFilesMP4Stream(FfmpegController.java:1107)
    05-08 11:17:03.775: W/System.err(25209):    at com.yoyo.videoeditor.EditorActivity.mergeVideosOld(EditorActivity.java:271)
    05-08 11:17:03.775: W/System.err(25209):    at com.yoyo.videoeditor.EditorActivity.access$0(EditorActivity.java:243)
    05-08 11:17:03.775: W/System.err(25209):    at com.yoyo.videoeditor.EditorActivity$3.onClick(EditorActivity.java:85)
    05-08 11:17:03.775: W/System.err(25209):    at android.view.View.performClick(View.java:4475)
    05-08 11:17:03.775: W/System.err(25209):    at android.view.View$PerformClick.run(View.java:18786)
    05-08 11:17:03.780: W/System.err(25209):    at android.os.Handler.handleCallback(Handler.java:730)
    05-08 11:17:03.780: W/System.err(25209):    at android.os.Handler.dispatchMessage(Handler.java:92)
    05-08 11:17:03.780: W/System.err(25209):    at android.os.Looper.loop(Looper.java:176)
    05-08 11:17:03.780: W/System.err(25209):    at android.app.ActivityThread.main(ActivityThread.java:5419)
    05-08 11:17:03.780: W/System.err(25209):    at java.lang.reflect.Method.invokeNative(Native Method)
    05-08 11:17:03.785: W/System.err(25209):    at java.lang.reflect.Method.invoke(Method.java:525)
    05-08 11:17:03.785: W/System.err(25209):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
    05-08 11:17:03.785: W/System.err(25209):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
    05-08 11:17:03.785: W/System.err(25209):    at dalvik.system.NativeStart.main(Native Method)
    05-08 11:17:03.785: W/System.err(25209): Caused by: java.io.IOException: Permission denied
    05-08 11:17:03.785: W/System.err(25209):    at java.lang.ProcessManager.exec(Native Method)
    05-08 11:17:03.790: W/System.err(25209):    at java.lang.ProcessManager.exec(ProcessManager.java:209)
    05-08 11:17:03.790: W/System.err(25209):    ... 20 more

    Here is my ffmpeg commands as given in the ffmpeg tutorial page.

    ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
    ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
    ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4

    FFMPEG library doesn’t seem to be working as expected. When I add commands and create output file using "touch" shell command file is being created. Still I am unable to see the output from ffmpeg as expected.