Recherche avancée

Médias (1)

Mot : - Tags -/swfupload

Autres articles (70)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (6316)

  • Can't play at a good framerate with JavaAV

    31 mars 2017, par TW2

    I have a problem in framerate when I use JavaAV (which use JavaCPP + ffmpeg). When I set my framerate as mentionned at DemuxerExample.java, the frame change each 47000ms which is too long and false. It’s better when I set 1000 / demuxer.getFrameRate() * 1000 ( 47ms) but it’s also false. I can’t have a good framerate. Here is my player class :

    package gr.av;

    import hoary.javaav.Audio;
    import hoary.javaav.AudioFrame;
    import hoary.javaav.Demuxer;
    import hoary.javaav.Image;
    import hoary.javaav.JavaAVException;
    import hoary.javaav.MediaFrame;
    import hoary.javaav.VideoFrame;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.SourceDataLine;
    import javax.sound.sampled.UnsupportedAudioFileException;
    import javax.swing.JPanel;

    public class Player extends JPanel {

       VideoThread videoTHREAD;
       AudioThread audioTHREAD;
       BufferedImage img = null;

       public Player() {
           init();
       }

       private void init(){        
           videoTHREAD = new VideoThread(this);
           audioTHREAD = new AudioThread();
       }

       public void setImage(BufferedImage img){
           this.img = img;
           repaint();
       }

       @Override
       public void paint(Graphics g){
           if(img != null){
               g.drawImage(img, 0, 0, null);
           }else{
               g.setColor(Color.blue);
               g.fillRect(0, 0, getWidth(), getHeight());
           }
       }

       public void setFilename(String filename){
           videoTHREAD.setFilename(filename);
           audioTHREAD.setFilename(filename);
       }

       public void play(){
           videoTHREAD.playThread();
           audioTHREAD.playThread();
       }

       public void stop(){
           videoTHREAD.stopThread();
           audioTHREAD.stopThread();
       }

       public static class VideoThread extends Thread {

           //The video filename and a controller
           String filename = null;
           private volatile boolean active = false;

           //Panel to see video
           Player player;

           public VideoThread(Player player) {
               this.player = player;
           }

           public void setFilename(String filename){
               this.filename = filename;
           }

           public void playThread(){
               if(filename != null && active == false){
                   active = true;
                   this.start();
               }
           }

           public void stopThread(){
               if(active == true){
                   active = false;
                   this.interrupt();
               }            
           }

           public void video() throws JavaAVException, InterruptedException, IOException, UnsupportedAudioFileException{            
               Demuxer demuxer = new Demuxer();
               demuxer.open(filename);

               MediaFrame mediaFrame;
               while (active && (mediaFrame = demuxer.readFrame()) != null) {
                   if (mediaFrame.getType() == MediaFrame.Type.VIDEO) {

                       VideoFrame videoFrame = (VideoFrame) mediaFrame;

                       player.setImage(Image.createImage(videoFrame, BufferedImage.TYPE_3BYTE_BGR));

                       double FPS = demuxer.getFrameRate() * 1000d;
                       long ms = (long)(1000d / FPS);
                       System.out.println("FPS = " + FPS + " ; Milliseconds = " + ms);
                       java.util.concurrent.TimeUnit.MILLISECONDS.sleep(ms);
                   }
               }
               demuxer.close();
           }

           @Override
           public void run() {
               if(filename != null){
                   try {
                       video();
                   } catch (JavaAVException | InterruptedException | IOException | UnsupportedAudioFileException ex) {
                          Logger.getLogger(Player.class.getName()).log(Level.SEVERE, null, ex);
                   }
               }
           }

       }

       public static class AudioThread extends Thread {

           //The video filename and a controller
           String filename = null;
           private volatile boolean active = false;

           //Audio
           AudioFormat format = new AudioFormat(44000, 16, 2, true, false);
           AudioInputStream ais;
           DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
           SourceDataLine soundLine;

           public AudioThread() {            
           }

           public void setFilename(String filename){
               this.filename = filename;
           }

           public void playThread(){
               if(filename != null && active == false){
                   active = true;
                   soundON();
                   this.start();
               }
           }

           public void stopThread(){
               if(active == true){
                   active = false;
                   soundOFF();
                   this.interrupt();
               }            
           }

           public void audio() throws JavaAVException, IOException {            
               Demuxer demuxer = new Demuxer();
               demuxer.open(filename);

               MediaFrame mediaFrame;
               while (active && (mediaFrame = demuxer.readFrame()) != null) {
                   if (mediaFrame.getType() == MediaFrame.Type.AUDIO) {
                       AudioFrame audioFrame = (AudioFrame) mediaFrame;
                       byte[] bytes = Audio.getAudio16(audioFrame);

                       try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
                           ais = new AudioInputStream(bais, format, bytes.length / format.getFrameSize());
                           try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
                               int nBufferSize = bytes.length * format.getFrameSize();
                               byte[] abBuffer = new byte[nBufferSize];

                               while (true){
                                   int nBytesRead = ais.read(abBuffer);
                                   if (nBytesRead == -1)
                                       break;

                                   baos.write(abBuffer, 0, nBytesRead);
                               }

                               byte[] abAudioData = baos.toByteArray();
                               soundLine.write(abAudioData, 0, abAudioData.length);
                           }
                           ais.close();
                       }

                   }
               }

               demuxer.close();
           }

           @Override
           public void run() {
               if(filename != null){
                   try {
                       audio();
                   } catch (JavaAVException | IOException ex) {
                       Logger.getLogger(Player.class.getName()).log(Level.SEVERE, null, ex);
                   }
               }
           }

           private void soundON(){
               try {
                   soundLine = (SourceDataLine) AudioSystem.getLine(info);
                   soundLine.open(format);
                   soundLine.start();
               } catch (LineUnavailableException ex) {
                   Logger.getLogger(Player.class.getName()).log(Level.SEVERE, null, ex);
               }
           }

           private void soundOFF(){
               soundLine.drain();
               soundLine.stop();
               soundLine.close();
           }

       }

    }
  • Specifying FFMPEG in the requirements section of 'buildozer.spec' causing [libavformat/network.o] Error 1

    18 juillet 2022, par GJ78

    My question relates to how to mitigate an ffmpeg requirement listed in a buildozer.spec that is causing compile errors using buildozer.

    



    GOAL :

    



    Using buildozer to ensure FFMPEG can be embedded within a small Kivy app so i can utilise youtube_dl functionality on my android phone.

    



    THE ISSUE :
Specifying FFMPEG in the requirements section of 'buildozer.spec' causes the following error message :
    
common.mak:60 : recipe for target 'libavformat/network.o' failed
    
make : [libavformat/network.o] Error 1
    
make : Waiting for unfinished jobs...

    



    What have I done to resolve myself :
    
1. Ensured LOG LEVEL 2 is specified.

    



      

    1. Upgraded cython from Version 21 to 27. Then downgraded to 25, then 21 then 20 to see if this resolved anything. It didn't.

    2. 


    3. In BUILDOZER.SPEC, switched between Android NDK crystax-ndk-10.3.2 and android-ndk-r16b. (Note have reverted back to Crystax 10.3.2) in my NDK PATH.

    4. 


    5. In BUILDOZER.SPEC, changed android.api from 19 to 15 (just to see if this has any positive effects).

    6. 


    7. executed : rm -Rf .buildozer between each compiling attempt.

    8. 


    9. Part extract of Buildozer.log :

      



      In file included from libavformat/dump.c:37:0 :
      
libavformat/avformat.h:893:21 : note : declared here
      
 AVCodecContext codec ;
 ^
      
CC libavformat/format.o
      
CC libavformat/golomb_tab.o
      
CC libavformat/h264dec.o
      
CC libavformat/hevc.o
      
CC libavformat/http.o
      
CC libavformat/httpauth.o
      
CC libavformat/id3v1.o
      
CC libavformat/id3v2.o
      
CC libavformat/img2.o
      
CC libavformat/isom.o
      
CC libavformat/log2_tab.o
      
CC libavformat/m4vdec.o
      
CC libavformat/metadata.o
CC libavformat/mov_chan.o
      
CC libavformat/mov.o
      
CC libavformat/movenc.o
      
CC libavformat/movenccenc.o
      
CC libavformat/movenchint.o
      
CC libavformat/mpegvideodec.o
      
CC libavformat/mux.o
      
CC libavformat/network.o
      
In file included from libavformat/network.h:29:0,
      
 from libavformat/network.c:22 :
      
libavformat/os_support.h:67:32 : error : expected declaration specifiers or '...' before '(' token
      
 # define lseek(f,p,w) lseek64((f), (p), (w))
      
 ^
libavformat/os_support.h:67:37 : error : expected declaration specifiers or '...' before '(' token
      
 # define lseek(f,p,w) lseek64((f), (p), (w))
      
 ^
libavformat/os_support.h:67:42 : error : expected declaration specifiers or '...' before '(' token
      
 # define lseek(f,p,w) lseek64((f), (p), (w))
      
 ^
common.mak:60 : recipe for target 'libavformat/network.o' failed
      
make :
      [libavformat/network.o] Error 1
      
make : * Waiting for unfinished jobs....

    10. 


    11. Part extract of Buildozer.spec

      



      (str) Title of your application

      



      title = myapplication

      



      (str) Package name

      



      package.name = myapp

      



      (str) Package domain (needed for android/ios packaging)

      



      package.domain = org.test

      



      (str) Source code where the main.py live

      



      source.dir = .

      



      (list) Source files to include (let empty to include all the files)

      



      source.include_exts = py,png,jpg,kv,atlas

      



      (list) List of inclusions using pattern matching

      



      source.include_patterns = assets/,images/.png

      



      (list) Source files to exclude (let empty to not exclude anything)

      



      source.exclude_exts = spec

      



      (list) List of directory to exclude (let empty to not exclude anything)

      



      source.exclude_dirs = tests, bin

      



      (list) List of exclusions using pattern matching

      



      source.exclude_patterns = license,images//.jpg

      



      (str) Application versioning (method 1)

      



      version = 0.1

      



      (str) Application versioning (method 2)

      



      version.regex = version = '"['"]

      



      version.filename = %(source.dir)s/main.py

      



      (list) Application requirements

      



      comma seperated e.g. requirements = sqlite3,kivy

      



      requirements = ffmpeg,python2,hostpython2,kivy,youtube-dl

      



      (str) Custom source folders for requirements

      



      Sets custom source for any requirements with recipes

      



      requirements.source.kivy = ../../kivy

      



      (list) Garden requirements

      



      garden_requirements =

      



      (str) Presplash of the application

      



      presplash.filename = %(source.dir)s/data/presplash.png

      



      (str) Icon of the application

      



      icon.filename = %(source.dir)s/data/icon.png

      



      (str) Supported orientation (one of landscape, portrait or all)

      



      orientation = portrait

      



      (list) List of service to declare

      



      services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY

      



      OSX Specific

      



      author = © Copyright Info

      



      change the major version of python used by the app

      



      osx.python_version = 3

      



      Kivy version to use

      



      osx.kivy_version = 1.9.1

      



      Android specific

      



      (bool) Indicate if the application should be fullscreen or not

      



      fullscreen = 0

      



      (string) Presplash background color (for new android toolchain)

      



      Supported formats are : #RRGGBB #AARRGGBB or one of the following names :

      



      red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray,

      



      darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy,

      



      olive, purple, silver, teal.

      



      android.presplash_color = #FFFFFF

      



      (list) Permissions

      



      android.permissions = INTERNET

      



      (int) Android API to use

      



      android.api = 19

      



      (int) Minimum API required

      



      android.minapi = 9

      



      (int) Android SDK version to use

      



      android.sdk = 20

      



      (str) Android NDK version to use

      



      android.ndk = 10.3.2

      



      (bool) Use —private data storage (True) or —dir public storage (False)

      



      android.private_storage = True

      



      (str) Android NDK directory (if empty, it will be automatically downloaded.)

      



      android.ndk_path = /home/gjones/Downloads/crystax-ndk-10.3.2

      



      (str) Android SDK directory (if empty, it will be automatically downloaded.)

      



      android.sdk_path =

      



      (str) ANT directory (if empty, it will be automatically downloaded.)

      



      android.ant_path =

    12. 


    13. Lastly, when I remove ffmpeg from requirements in buildozer.spec, the .APK compiles successfully and i can deploy it on to my phone with the KIVY GUI. Obviously, ffmpeg functionality is not present.

    14. 


    



    Current Environment Specs :

    



      

    1. Running Linux Mint 17.2 as a Virtual Box VM
    2. 


    3. Buildozer Version : 0.35dev
    4. 


    5. Cython Version : 0.25
    6. 


    



    Any advice would be greatly appreciated.

    



    Lastly, if there is no obvious solution via buildozer, do i need to compile ffmpeg for Android separately and somehow include this somewhere in the buildozer spec file to prevent this error message ?

    



    Thanks in advance.

    


  • Creating buttons with Imagick

    9 juin 2010, par Mikko Koppanen — Imagick, PHP stuff

    A fellow called kakapo asked me to create a button with Imagick. He had an image of the button and a Photoshop tutorial but unfortunately the tutorial was in Chinese. My Chinese is a bit rusty so it will take a little longer to create that specific button ;)

    The button in this example is created after this tutorial http://xeonfx.com/tutorials/easy-button-tutorial/ (yes, I googled “easy button tutorial”). The code and the button it creates are both very simple but the effect looks really nice.

    Here we go with the code :

    1. < ?php
    2.  
    3. /* Create a new Imagick object */
    4. $im = new Imagick() ;
    5.  
    6. /* Create empty canvas */
    7. $im->newImage( 200, 200, "white", "png" ) ;
    8.  
    9. /* Create the object used to draw */
    10. $draw = new ImagickDraw() ;
    11.  
    12. /* Set the button color.
    13.   Changing this value changes the color of the button */
    14. $draw->setFillColor( "#4096EE" ) ;
    15.  
    16. /* Create the outer circle */
    17. $draw->circle( 50, 50, 70, 70 ) ;
    18.  
    19. /* Create the smaller circle on the button */
    20. $draw->setFillColor( "white" ) ;
    21.  
    22. /* Semi-opaque fill */
    23. $draw->setFillAlpha( 0.2 ) ;
    24.  
    25. /* Draw the circle */
    26. $draw->circle( 50, 50, 68, 68 ) ;
    27.  
    28. /* Set the font */
    29. $draw->setFont( "./test1.ttf" ) ;
    30.  
    31. /* This is the alpha value used to annotate */
    32. $draw->setFillAlpha( 0.17 ) ;
    33.  
    34. /* Draw a curve on the button with 17% opaque fill */
    35. $draw->bezier( array(
    36.           array( "x" => 10 , "y" => 25 ),
    37.           array( "x" => 39, "y" => 49 ),
    38.           array( "x" => 60, "y" => 55 ),
    39.           array( "x" => 75, "y" => 70 ),
    40.           array( "x" => 100, "y" => 70 ),
    41.           array( "x" => 100, "y" => 10 ),
    42.          ) ) ;
    43.  
    44. /* Render all pending operations on the image */       
    45. $im->drawImage( $draw ) ;
    46.  
    47. /* Set fill to fully opaque */
    48. $draw->setFillAlpha( 1 ) ;
    49.  
    50. /* Set the font size to 30 */
    51. $draw->setFontSize( 30 ) ;
    52.  
    53. /* The text on the */
    54. $draw->setFillColor( "white" ) ;
    55.  
    56. /* Annotate the text */
    57. $im->annotateImage( $draw, 38, 55, 0, "go" ) ;
    58.  
    59. /* Trim extra area out of the image */
    60. $im->trimImage( 0 ) ;
    61.  
    62. /* Output the image */
    63. header( "Content-Type : image/png" ) ;
    64. echo $im ;
    65.  
    66.  ?>

    And here is a few buttons I created by changing the fill color value :

    red

    green

    blue