Recherche avancée

Médias (91)

Autres articles (33)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, 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 (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

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

Sur d’autres sites (4068)

  • Compress video FFMPEG doesn't work

    30 juillet 2015, par Douglas Anunciação

    I’m trying to compress video using FFMPEG and this library : https://github.com/guardianproject/android-ffmpeg-java

    I imported ffmpeglib as a module in my project. This is the code is use to compress :

    public class MainActivity extends Activity {

       private ArrayList&lt;Object&gt; listVideoPaths = new ArrayList&lt;&gt;();<br />
    <br />
       @Override<br />
       protected void onCreate(Bundle savedInstanceState) {<br />
           super.onCreate(savedInstanceState);<br />
           setContentView(R.layout.activity_main);<br />
    <br />
           getGalleryVideos();<br />
    <br />
           File videoFolderFile = new File(&quot;/storage/emulated/0/DCIM/Camera/&quot;);<br />
    <br />
           if(videoFolderFile.exists())<br />
               Log.e(&quot;TEST FFMPEG&quot;, &quot;video folder exist&quot;);<br />
           else<br />
               Log.e(&quot;TEST FFMPEG&quot;, &quot;video folder DON'T exist&quot;);<br />
    <br />
    <br />
           File videoInputFile = new File(listVideoPaths.get(0).toString());<br />
    <br />
           if(videoInputFile.exists())<br />
               Log.e(&quot;TEST FFMPEG&quot;, &quot;video input file exist&quot;);<br />
           else<br />
               Log.e(&quot;TEST FFMPEG&quot;, &quot;video input file DON'T exist&quot;);<br />
    <br />
           File videoOutputFile = new File(videoFolderFile,&quot;output.mp4&quot;);<br />
    <br />
           if(videoOutputFile.exists())<br />
               Log.e(&quot;TEST FFMPEG&quot;, &quot;video output file exist&quot;);<br />
           else<br />
               Log.e(&quot;TEST FFMPEG&quot;, &quot;video output file DON'T exist&quot;);<br />
    <br />
           FfmpegController ffmpegController;<br />
    <br />
           try {<br />
               ffmpegController = new FfmpegController(this,videoFolderFile);<br />
    <br />
               Clip mediaIn = new Clip();<br />
    <br />
               mediaIn.path = videoInputFile.getAbsolutePath();<br />
    <br />
               mediaIn.videoFps =  &quot;25&quot;;<br />
    <br />
               ffmpegController.convertToMPEG(mediaIn, videoOutputFile.getAbsolutePath(), new ShellUtils.ShellCallback() {<br />
    <br />
                   @Override<br />
                   public void shellOut(String shellLine) {<br />
                       Log.e(&quot;TEST FFMPEG&quot;, &quot;shellOut - &quot; + shellLine);<br />
                   }<br />
    <br />
                   @Override<br />
                   public void processComplete(int exitValue) {<br />
                       Log.e(&quot;TEST FFMPEG&quot;, &quot;proccess complete - &quot; + exitValue);<br />
                   }<br />
               });<br />
    <br />
    <br />
           } catch (IOException e) {<br />
               e.printStackTrace();<br />
           } catch (Exception e) {<br />
               e.printStackTrace();<br />
           }finally {<br />
    <br />
               if(videoOutputFile.exists())<br />
                   Log.e(&quot;TEST FFMPEG&quot;, &quot;finished ffmpeg ---&gt; video output file exist&quot;);<br />
               else<br />
                   Log.e(&quot;TEST FFMPEG&quot;, &quot;finished ffmpeg ---&gt; video output file DON'T exist&quot;);<br />
    <br />
           }<br />
       }<br />
    <br />
       private void getGalleryVideos(){<br />
    <br />
           Cursor videoCursor = null;<br />
    <br />
           try {<br />
    <br />
               final String[] columns = { Media.DATA,<br />
                       Media._ID,<br />
                       Media.DATE_ADDED };<br />
    <br />
               final String orderBy = Media.DATE_ADDED;<br />
    <br />
               videoCursor = getContentResolver().query(<br />
                       MediaStore.Video.Media.EXTERNAL_CONTENT_URI, columns,<br />
                       null, null, orderBy);<br />
    <br />
               if (videoCursor != null &amp;amp;&amp;amp; videoCursor.getCount() &gt; 0) {<br />
    <br />
                   while (videoCursor.moveToNext()) {<br />
    <br />
                       int dataColumnIndex = videoCursor<br />
                               .getColumnIndex(Media.DATA);<br />
    <br />
                       listVideoPaths.add(videoCursor<br />
                               .getString(dataColumnIndex));<br />
    <br />
                   }<br />
    <br />
               }<br />
    <br />
               Collections.sort(listVideoPaths,new Comparator());<br />
    <br />
           } catch (Exception e) {<br />
    <br />
               e.printStackTrace();<br />
    <br />
           } finally {<br />
    <br />
               if (videoCursor != null) {<br />
    <br />
                   if (!videoCursor.isClosed()) {<br />
    <br />
                       videoCursor.close();<br />
    <br />
                   }<br />
    <br />
               }<br />
    <br />
           }<br />
    <br />
       }<br />
    <br />
    }<br />
    &lt;/code&gt;&lt;/pre&gt;<br />
    <br />
    &lt;p&gt;I get no error but the video doesn't play. The log file is:&lt;/p&gt;<br />
    <br />
    &lt;blockquote&gt;<br />
     &lt;p&gt;3096-3096/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     video folder exist 07-30 14:31:57.389&lt;br&gt;<br />
     3096-3096/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     video input file exist 07-30 14:31:57.389&lt;br&gt;<br />
     3096-3096/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     video output file DON'T exist 07-30 14:31:58.363&lt;br&gt;<br />
     3096-3096/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -<br />
     /data/data/douglasanunciacao.androidffmpegjavateste/app_bin/ffmpeg -y<br />
     -i /storage/emulated/0/DCIM/Camera/VID_20150730_142330563.mp4 -f mpeg /storage/emulated/0/DCIM/Camera/output.mp4 07-30 14:31:58.385&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - WARNING: linker:<br />
     /data/data/douglasanunciacao.androidffmpegjavateste/app_bin/ffmpeg has<br />
     text relocations. This is wasting memory and prevents security<br />
     hardening. Please fix. 07-30 14:31:58.390&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg<br />
     developers 07-30 14:31:58.391&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   built on Dec 22 2014 12:52:34 with gcc 4.6 20120106<br />
     (prerelease) 07-30 14:31:58.391&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   configuration: --arch=arm --cpu=cortex-a8<br />
     --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-<br />
     --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib 07-30 14:31:58.391&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   libavutil      51. 54.100 / 51. 54.100 07-30 14:31:58.391<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   libavcodec     54. 23.100 / 54. 23.100 07-30 14:31:58.391<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   libavformat    54.  6.100 / 54.  6.100 07-30 14:31:58.391<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   libavdevice    54.  0.100 / 54.  0.100 07-30 14:31:58.391<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   libavfilter     2. 77.100 /  2. 77.100 07-30 14:31:58.391<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   libswscale      2.  1.100 /  2.  1.100 07-30 14:31:58.391<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   libswresample   0. 15.100 /  0. 15.100 07-30 14:31:58.391<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   libpostproc    52.  0.100 / 52.  0.100 07-30 14:31:58.868<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - Input #0, mov,mp4,m4a,3gp,3g2,mj2, from<br />
     '/storage/emulated/0/DCIM/Camera/VID_20150730_142330563.mp4': 07-30<br />
     14:31:58.869    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -   Metadata: 07-30 14:31:58.869&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     major_brand     : mp42 07-30 14:31:58.870&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     minor_version   : 0 07-30 14:31:58.871&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     compatible_brands: isommp42 07-30 14:31:58.872&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     creation_time   : 2015-07-30 17:23:34 07-30<br />
     14:31:58.873    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -   Duration: 00:00:01.89, start: 0.000000,<br />
     bitrate: 17571 kb/s 07-30 14:31:58.874&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     Stream #0:0(eng): Video: h264 (High) (avc1 /<br />
     0x31637661), yuv420p, 1920x1080, 15874 kb/s, SAR 65536:65536 DAR 16:9,<br />
     23.90 fps, 23.92 tbr, 90k tbn, 180k tbc 07-30 14:31:58.875    3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     Metadata: 07-30 14:31:58.876&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -       rotate          : 270 07-30 14:31:58.877&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -       creation_time   : 2015-07-30 17:23:34 07-30<br />
     14:31:58.878    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -       handler_name    : VideoHandle 07-30<br />
     14:31:58.878    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -     Stream #0:1(eng): Audio: aac (mp4a /<br />
     0x6134706D), 48000 Hz, stereo, s16, 127 kb/s 07-30 14:31:58.878&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     Metadata: 07-30 14:31:58.878&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -       creation_time   : 2015-07-30 17:23:34 07-30<br />
     14:31:58.878    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -       handler_name    : SoundHandle 07-30<br />
     14:31:58.882    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut - [buffer @ 0xb5cce0a0] w:1920 h:1080<br />
     pixfmt:yuv420p tb:1/90000 sar:65536/65536 sws_param:flags=2 07-30<br />
     14:31:58.882    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut - [buffersink @ 0xb5cce0d0] No opaque field<br />
     provided 07-30 14:31:58.891&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - [mpeg @ 0xb5c3df00] VBV buffer size not set, muxing may<br />
     fail 07-30 14:31:58.892&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - Output #0, mpeg, to<br />
     '/storage/emulated/0/DCIM/Camera/output.mp4': 07-30 14:31:58.894&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   Metadata: 07-30 14:31:58.895&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     major_brand     : mp42 07-30 14:31:58.896&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     minor_version   : 0 07-30 14:31:58.896&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     compatible_brands: isommp42 07-30 14:31:58.897&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     creation_time   : 2015-07-30 17:23:34 07-30<br />
     14:31:58.898    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -     encoder         : Lavf54.6.100 07-30<br />
     14:31:58.898    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -     Stream #0:0(eng): Video: mpeg1video,<br />
     yuv420p, 1920x1080 [SAR 65536:65536 DAR 16:9], q=2-31, 200 kb/s, 90k<br />
     tbn, 23.98 tbc 07-30 14:31:58.899&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     Metadata: 07-30 14:31:58.899&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -       rotate          : 270 07-30 14:31:58.900&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -       creation_time   : 2015-07-30 17:23:34 07-30<br />
     14:31:58.901    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -       handler_name    : VideoHandle 07-30<br />
     14:31:58.906    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -     Stream #0:1(eng): Audio: mp2, 48000 Hz,<br />
     stereo, s16, 128 kb/s 07-30 14:31:58.906&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -     Metadata: 07-30 14:31:58.906&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -       creation_time   : 2015-07-30 17:23:34 07-30<br />
     14:31:58.906    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -       handler_name    : SoundHandle 07-30<br />
     14:31:58.906    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut - Stream mapping: 07-30 14:31:58.906&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut -   Stream #0:0 -&gt; #0:0 (h264 -&gt; mpeg1video) 07-30<br />
     14:31:58.906    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut -   Stream #0:1 -&gt; #0:1 (aac -&gt; mp2) 07-30<br />
     14:31:58.906    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut - Press [q] to stop, [?] for help 07-30<br />
     14:31:59.824    3096-3182/douglasanunciacao.androidffmpegjavateste<br />
     E/TESTE FFMPEG﹕ shellOut - frame=    4 fps=0.0 q=2.0 size=       0kB<br />
     time=00:00:00.08 bitrate=   0.0kbits/s 07-30 14:32:02.029&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - frame=    8 fps=2.7 q=10.5 size=       4kB time=00:00:00.25<br />
     bitrate= 130.9kbits/s 07-30 14:32:02.536&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - frame=   13 fps=3.7 q=25.2 size=     696kB time=00:00:00.45<br />
     bitrate=12427.3kbits/s 07-30 14:32:03.045&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - frame=   18 fps=4.4 q=31.0 size=     750kB time=00:00:00.66<br />
     bitrate=9206.8kbits/s 07-30 14:32:03.582&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - frame=   23 fps=5.0 q=31.0 size=     786kB time=00:00:00.87<br />
     bitrate=7351.4kbits/s 07-30 14:32:04.140&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - frame=   28 fps=5.5 q=31.0 size=     862kB time=00:00:01.08<br />
     bitrate=6511.8kbits/s 07-30 14:32:05.239&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - frame=   30 fps=4.8 q=31.0 size=     876kB time=00:00:01.16<br />
     bitrate=6144.9kbits/s 07-30 14:32:05.746&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - frame=   35 fps=5.2 q=31.0 size=     910kB time=00:00:01.37<br />
     bitrate=5416.2kbits/s 07-30 14:32:06.317&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - frame=   41 fps=5.6 q=31.0 size=     972kB time=00:00:01.62<br />
     bitrate=4895.2kbits/s 07-30 14:32:06.832&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - frame=   45 fps=5.7 q=31.0 Lsize=    1022kB<br />
     time=00:00:01.83 bitrate=4562.1kbits/s 07-30 14:32:06.832&lt;br&gt;<br />
     3096-3182/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     shellOut - video:984kB audio:30kB global headers:0kB muxing overhead<br />
     0.756932% 07-30 14:32:06.858    3096-3096/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     proccess complete - 0 07-30 14:32:06.858&lt;br&gt;<br />
     3096-3096/douglasanunciacao.androidffmpegjavateste E/TESTE FFMPEG﹕<br />
     terminou o ffmpeg ---&gt; video output file exist&lt;/p&gt;<br />
    &lt;/blockquote&gt;<br />
    <br />
    &lt;p&gt;Does anyone knows how to solve this problem? Thanks in advance.&lt;/p&gt;
  • Evolution #3518 (Nouveau) : #contenu et cfg utilisateur Grand écran / Petit écran

    29 juillet 2015, par PIerre LASZCZAK

    Bonjour,

    Le passage de Petit écran -> Ecran large n’a aucun effet sur la


    Au final cette option ne fait qu’élargir le bandeau et le pied de page...
    En l’état, cette fonctionnalité semble quasi inutile.

    Pour ma part, un simple

     body.large #contenuwidth:756px !important ;
    


    Sauve la mise de l’option "Ecran large" ( je n’ai jamais vu de colonne à droite dans l’espace privé de spip, mis à part un encart "dans la même rubrique" sur un article )

  • video proccesing : extract frames and encrypt them then insert them back to the video in java using xuggler

    24 juillet 2015, par Anas M. Jubara

    I’m working on a video encryption application .. the main idea is to input the video file to the application and the application should output it in an encrypted form... am using xuggler library to manipulate the video and get to the frames and AES for encryption.
    my code works fine for accessing the frames and encrypting them, what i need help with is how to write the encrypted frame back to the video file to replace the original one without corrupting the video file for the video players.
    Here is my code

    package xuggler;

    import com.xuggle.mediatool.IMediaReader;
    import com.xuggle.mediatool.IMediaWriter;
    import com.xuggle.mediatool.MediaListenerAdapter;
    import com.xuggle.mediatool.ToolFactory;
    import com.xuggle.mediatool.event.IVideoPictureEvent;
    import com.xuggle.xuggler.Global;
    import com.xuggle.xuggler.ICodec;

    import java.awt.Graphics2D;
    import java.awt.Point;
    import java.awt.Transparency;
    import java.awt.image.BufferedImage;
    import java.awt.image.ColorModel;
    import java.awt.image.ComponentColorModel;
    import java.awt.image.DataBuffer;
    import java.awt.image.DataBufferByte;
    import java.awt.image.Raster;
    import java.awt.image.WritableRaster;

    import java.io.File;

    import java.security.InvalidKeyException;
    import java.security.NoSuchAlgorithmException;
    import java.security.SecureRandom;

    import java.util.concurrent.TimeUnit;
    import java.util.logging.Level;
    import java.util.logging.Logger;

    import javax.crypto.BadPaddingException;
    import javax.crypto.Cipher;
    import javax.crypto.IllegalBlockSizeException;
    import javax.crypto.KeyGenerator;
    import javax.crypto.NoSuchPaddingException;
    import javax.crypto.SecretKey;

    import javax.imageio.ImageIO;


    public class DecodeAndCaptureFrames extends MediaListenerAdapter
    {

    // The number of seconds between frames.
         public static final double SECONDS_BETWEEN_FRAMES = 5;

     //The number of micro-seconds between frames.
     public static final long MICRO_SECONDS_BETWEEN_FRAMES =(long)      (Global.DEFAULT_PTS_PER_SECOND * SECONDS_BETWEEN_FRAMES);

     // Time of last frame write
     private static long mLastPtsWrite = Global.NO_PTS;

    private static final double FRAME_RATE = 50;

    private static final int SECONDS_TO_RUN_FOR = 20;

    private static final String outputFilename = "D:\\K.mp4";

    public static IMediaWriter writer = ToolFactory.makeWriter(outputFilename);
    //receive BufferedImage and returns its byte data
       public static byte[] get_byte_data(BufferedImage image) {
       WritableRaster raster = image.getRaster();
       DataBufferByte buffer = (DataBufferByte) raster.getDataBuffer();
       return buffer.getData();
    }


    //create new_img with the attributes of image
    public static BufferedImage user_space(BufferedImage image) {
       //create new_img with the attributes of image
       BufferedImage new_img = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
       Graphics2D graphics = new_img.createGraphics();
       graphics.drawRenderedImage(image, null);
       graphics.dispose(); //release all allocated memory for this image
       return new_img;
    }

    public static BufferedImage toImage(byte[] imagebytes, int width, int height) {
       DataBuffer buffer = new DataBufferByte(imagebytes, imagebytes.length);
       WritableRaster raster = Raster.createInterleavedRaster(buffer, width, height,
          3 * width, 3, new int[]{2, 1, 0}, (Point) null);

       ColorModel cm = new ComponentColorModel(ColorModel.getRGBdefault().getColorSpace(),
               false, true, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
       return new BufferedImage(cm, raster, true, null);
    }

    public static byte[] encrypt(byte[] orgnlbytes, String key) throws NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
       byte[] encbytes = null;
       try {
           Cipher cipher = Cipher.getInstance("AES");
           KeyGenerator keyGen = KeyGenerator.getInstance("AES");
           SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
           // cryptograph. secure random
           random.setSeed(key.getBytes());

           keyGen.init(128, random);
           // for example
           SecretKey secretKey = keyGen.generateKey();
           try {
               cipher.init(Cipher.ENCRYPT_MODE, secretKey);
           } catch (InvalidKeyException ex) {
               Logger.getLogger(DecodeAndCaptureFrames.class.getName()).log(Level.SEVERE, null, ex);
           }
           encbytes = cipher.doFinal(orgnlbytes);
       }
       catch (NoSuchAlgorithmException ex) {
           Logger.getLogger(DecodeAndCaptureFrames.class.getName()).log(Level.SEVERE, null, ex);
       }        catch (NoSuchPaddingException ex)
       {
           System.out.print("can not encrypt buffer");
       }

       return encbytes;
    }


     /**
      * The video stream index, used to ensure we display frames from one
      * and only one video stream from the media container.
      */

     private int mVideoStreamIndex = -1;

     /**
      * Takes a media container (file) as the first argument, opens it and
      *  writes some of it's video frames to PNG image files in the
      *  temporary directory.
      *
      * @param args must contain one string which represents a filename
      */

     public static void main(String[] args)
     {
       // create a new mr. decode and capture frames


       DecodeAndCaptureFrames decodeAndCaptureFrames;
       decodeAndCaptureFrames = new DecodeAndCaptureFrames("D:\\K.mp4");
     }

     /** Construct a DecodeAndCaptureFrames which reads and captures
      * frames from a video file.
      *
      * @param filename the name of the media file to read
      */


     //makes reader to the file and read the data of it
     public DecodeAndCaptureFrames(String filename)
     {
       // create a media reader for processing video

      IMediaReader reader = ToolFactory.makeReader(filename);

    // stipulate that we want BufferedImages created in BGR 24bit color space
    reader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);


    // note that DecodeAndCaptureFrames is derived from
    // MediaReader.ListenerAdapter and thus may be added as a listener
    // to the MediaReader. DecodeAndCaptureFrames implements
    // onVideoPicture().

    reader.addListener(this);

    // read out the contents of the media file, note that nothing else
    // happens here.  action happens in the onVideoPicture() method
    // which is called when complete video pictures are extracted from
    // the media source

    while (reader.readPacket() == null)
     do {} while(false);
     }

    /**
      * Called after a video frame has been decoded from a media stream.
      * Optionally a BufferedImage version of the frame may be passed
      * if the calling {@link IMediaReader} instance was configured to
      * create BufferedImages.
      *
      * This method blocks, so return quickly.
      */

     public void onVideoPicture(IVideoPictureEvent event)
     {
       try
       {
         // if the stream index does not match the selected stream index,
         // then have a closer look

     if (event.getStreamIndex() != mVideoStreamIndex)
     {
       // if the selected video stream id is not yet set, go ahead an
       // select this lucky video stream

       if (-1 == mVideoStreamIndex)
         mVideoStreamIndex = event.getStreamIndex();

       // otherwise return, no need to show frames from this video stream

       else
         return;
     }

     // if uninitialized, backdate mLastPtsWrite so we get the very
     // first frame

     if (mLastPtsWrite == Global.NO_PTS)
       mLastPtsWrite = event.getTimeStamp() - MICRO_SECONDS_BETWEEN_FRAMES;

     // if it's time to write the next frame

     if (event.getTimeStamp() - mLastPtsWrite >= MICRO_SECONDS_BETWEEN_FRAMES)
     {
       // Make a temporary file name

      // File file = File.createTempFile("frame", ".jpeg");

       // write out PNG

    //        ImageIO.write(event.getImage(), "png", file);

       BufferedImage orgnlimage = event.getImage();
           orgnlimage = user_space(orgnlimage);
           byte[] orgnlimagebytes = get_byte_data(orgnlimage);
           byte[] encryptedbytes = encrypt(orgnlimagebytes, "abc");
           BufferedImage encryptedimage = toImage(encryptedbytes, orgnlimage.getWidth(), orgnlimage.getHeight());


           ImageIO.write(encryptedimage, "png", File.createTempFile("frame", ".png"));
    //         indicate file written

       double seconds = ((double)event.getTimeStamp())
         / Global.DEFAULT_PTS_PER_SECOND;
    //        System.out.printf("at elapsed time of %6.3f seconds wrote: %s\n",seconds, file);

       // update last write time

       mLastPtsWrite += MICRO_SECONDS_BETWEEN_FRAMES;
     }
    }
    catch (Exception e)
    {
     e.printStackTrace();
    }
     }

    }