Recherche avancée

Médias (1)

Mot : - Tags -/biographie

Autres articles (96)

  • Les sons

    15 mai 2013, par
  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

Sur d’autres sites (5341)

  • 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

  • Stream image from Android with FFMPEG

    9 février 2023, par xnok

    I'm currently receiving images from an external source as byte array and I would like to send it as raw video format via ffmpeg to a stream URL, where I have a RTSP server that receives RTSP streams (a similar unanswered question). However, I haven't worked with FFMPEG in Java, so i can't find an example on how to do it. I have a callback that copies the image bytes to a byte array as follows :

    &#xA;

            public class MainActivity extends Activity {&#xA;            final String rtmp_url = "rtmp://192.168.0.12:1935/live/test";&#xA;            private int PREVIEW_WIDTH = 384;&#xA;            private int PREVIEW_HEIGHT = 292;&#xA;            private String TAG = "MainActivity";&#xA;            String ffmpeg = Loader.load(org.bytedeco.ffmpeg.ffmpeg.class);&#xA;            final String command[] = {ffmpeg,&#xA;                            "-y",  //Add "-re" for simulated readtime streaming.&#xA;                            "-f", "rawvideo",&#xA;                            "-vcodec", "rawvideo",&#xA;                            "-pix_fmt", "bgr24",&#xA;                            "-s", (Integer.toString(PREVIEW_WIDTH) &#x2B; "x" &#x2B; Integer.toString(PREVIEW_HEIGHT)),&#xA;                            "-r", "10",&#xA;                            "-i", "pipe:",&#xA;                            "-c:v", "libx264",&#xA;                            "-pix_fmt", "yuv420p",&#xA;                            "-preset", "ultrafast",&#xA;                            "-f", "flv",&#xA;                            rtmp_url};&#xA;            &#xA;      private UVCCamera mUVCCamera;&#xA;&#xA;public void handleStartPreview(Object surface) throws InterruptedException, IOException {&#xA;    Log.e(TAG, "handleStartPreview:mUVCCamera" &#x2B; mUVCCamera &#x2B; " mIsPreviewing:");&#xA;    if ((mUVCCamera == null)) return;&#xA;    Log.e(TAG, "handleStartPreview2 ");&#xA;    try {&#xA;        mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 26, 0, UVCCamera.DEFAULT_BANDWIDTH, 0);&#xA;        Log.e(TAG, "handleStartPreview3 mWidth: " &#x2B; mWidth &#x2B; "mHeight:" &#x2B; mHeight);&#xA;    } catch (IllegalArgumentException e) {&#xA;        try {&#xA;            // fallback to YUV mode&#xA;            mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 26, UVCCamera.DEFAULT_PREVIEW_MODE, UVCCamera.DEFAULT_BANDWIDTH, 0);&#xA;            Log.e(TAG, "handleStartPreview4");&#xA;        } catch (IllegalArgumentException e1) {&#xA;            callOnError(e1);&#xA;            return;&#xA;        }&#xA;    }&#xA;    Log.e(TAG, "handleStartPreview: startPreview1");&#xA;    int result = mUVCCamera.startPreview();&#xA;    mUVCCamera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_RGBX);&#xA;    mUVCCamera.startCapture();&#xA;    Toast.makeText(MainActivity.this,"Camera Started",Toast.LENGTH_SHORT).show();&#xA;    ProcessBuilder pb = new ProcessBuilder(command);&#xA;    pb.redirectErrorStream(true);&#xA;    Process process = pb.start();&#xA;    BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));&#xA;    OutputStream writer = process.getOutputStream();&#xA;    byte img[] = new byte[192*108*3];&#xA;    for (int i = 0; i &lt; 10; i&#x2B;&#x2B;)&#xA;    {&#xA;        for (int y = 0; y &lt; 108; y&#x2B;&#x2B;)&#xA;        {&#xA;            for (int x = 0; x &lt; 192; x&#x2B;&#x2B;)&#xA;            {&#xA;                byte r = (byte)((x * y &#x2B; i) % 255);&#xA;                byte g = (byte)((x * y &#x2B; i*10) % 255);&#xA;                byte b = (byte)((x * y &#x2B; i*20) % 255);&#xA;                img[(y*192 &#x2B; x)*3] = b;&#xA;                img[(y*192 &#x2B; x)*3&#x2B;1] = g;&#xA;                img[(y*192 &#x2B; x)*3&#x2B;2] = r;&#xA;            }&#xA;        }&#xA;&#xA;        writer.write(img);&#xA;    }&#xA;&#xA;    writer.close();&#xA;    String line;&#xA;    while ((line = reader.readLine()) != null)&#xA;    {&#xA;        System.out.println(line);&#xA;    }&#xA;&#xA;    process.waitFor();&#xA;}&#xA;public static void buildRawFrame(Mat img, int i)&#xA;{&#xA;    int p = img.cols() / 60;&#xA;    img.setTo(new Scalar(60, 60, 60));&#xA;    String text = Integer.toString(i&#x2B;1);&#xA;    int font = Imgproc.FONT_HERSHEY_SIMPLEX;&#xA;    Point pos = new Point(img.cols()/2-p*10*(text.length()), img.rows()/2&#x2B;p*10);&#xA;    Imgproc.putText(img, text, pos, font, p, new Scalar(255, 30, 30), p*2);  //Blue number&#xA;}&#xA;

    &#xA;

    Additionally : Android Camera Capture using FFmpeg

    &#xA;

    uses ffmpeg to capture frame by frame from native android camera and instead of pushing it via RTMP, they used to generate a video file as output. Although how the image was passed via ffmpeg was not informed.

    &#xA;

    frameData is my byte array and I'd like to know how can I write the necessary ffmpeg commands using ProcessBuilder to send an image via RTSP using ffmpeg for a given URL.

    &#xA;

    An example of what I am trying to do, In Python 3 I could easily do it by doing :

    &#xA;

    import cv2&#xA;import numpy as np&#xA;import socket&#xA;import sys&#xA;import pickle&#xA;import struct&#xA;import subprocess&#xA;&#xA;fps = 25&#xA;width = 224&#xA;height = 224&#xA;rtmp_url = &#x27;rtmp://192.168.0.13:1935/live/test&#x27;&#xA;    &#xA;    &#xA;    &#xA;    command = [&#x27;ffmpeg&#x27;,&#xA;               &#x27;-y&#x27;,&#xA;               &#x27;-f&#x27;, &#x27;rawvideo&#x27;,&#xA;               &#x27;-vcodec&#x27;, &#x27;rawvideo&#x27;,&#xA;               &#x27;-pix_fmt&#x27;, &#x27;bgr24&#x27;,&#xA;               &#x27;-s&#x27;, "{}x{}".format(width, height),&#xA;               &#x27;-r&#x27;, str(fps),&#xA;               &#x27;-i&#x27;, &#x27;-&#x27;,&#xA;               &#x27;-c:v&#x27;, &#x27;libx264&#x27;,&#xA;               &#x27;-pix_fmt&#x27;, &#x27;yuv420p&#x27;,&#xA;               &#x27;-preset&#x27;, &#x27;ultrafast&#x27;,&#xA;               &#x27;-f&#x27;, &#x27;flv&#x27;,&#xA;               rtmp_url]&#xA;    &#xA;    p = subprocess.Popen(command, stdin=subprocess.PIPE)&#xA;    &#xA;    while(True):&#xA;        frame = np.random.randint([255], size=(224, 224, 3))&#xA;        frame = frame.astype(np.uint8)&#xA;        p.stdin.write(frame.tobytes())&#xA;

    &#xA;

    I would like to do the same thing in Android

    &#xA;

    Update : I can reproduce @Rotem 's answer on Netbeans although, in Android I am getting NullPointer exception error when trying to execute pb.start().

    &#xA;

        Process: com.infiRay.XthermMini, PID: 32089&#xA;    java.lang.NullPointerException&#xA;        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1012)&#xA;        at com.infiRay.XthermMini.MainActivity.handleStartPreview(MainActivity.java:512)&#xA;        at com.infiRay.XthermMini.MainActivity.startPreview(MainActivity.java:563)&#xA;        at com.infiRay.XthermMini.MainActivity.access$1000(MainActivity.java:49)&#xA;        at com.infiRay.XthermMini.MainActivity$3.onConnect(MainActivity.java:316)&#xA;        at com.serenegiant.usb.USBMonitor$3.run(USBMonitor.java:620)&#xA;        at android.os.Handler.handleCallback(Handler.java:938)&#xA;        at android.os.Handler.dispatchMessage(Handler.java:99)&#xA;        at android.os.Looper.loopOnce(Looper.java:226)&#xA;        at android.os.Looper.loop(Looper.java:313)&#xA;        at android.os.HandlerThread.run(HandlerThread.java:67)&#xA;2022-06-02 11:47:20.300 32089-1049/com.infiRay.XthermMini E/libUVCCamera: [1049*UVCPreviewIR.cpp:505:uvc_preview_frame_callback]:receive err data&#xA;2022-06-02 11:47:20.304 32089-1049/com.infiRay.XthermMini E/libUVCCamera: [1049*UVCPreviewIR.cpp:505:uvc_preview_frame_callback]:receive err data&#xA;2022-06-02 11:47:20.304 32089-1049/com.infiRay.XthermMini E/libUVCCamera: [1049*UVCPreviewIR.cpp:505:uvc_preview_frame_callback]:receive err data&#xA;2022-06-02 11:47:20.308 32089-1049/com.infiRay.XthermMini E/libUVCCamera: [1049*UVCPreviewIR.cpp:505:uvc_preview_frame_callback]:receive err data&#xA;2022-06-02 11:47:20.312 32089-32089/com.infiRay.XthermMini E/MainActivity: onPause:&#xA;2022-06-02 11:47:20.314 32089-32581/com.infiRay.XthermMini I/Process: Sending signal. PID: 32089 SIG: 9&#xA;

    &#xA;