
Recherche avancée
Médias (1)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
Autres articles (96)
-
Les sons
15 mai 2013, par -
Contribute to a better visual interface
13 avril 2011MediaSPIP 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, parMultilang 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 GJ78My 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.


- 

-
Upgraded cython from Version 21 to 27. Then downgraded to 25, then 21 then 20 to see if this resolved anything. It didn't.
-
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.
-
In BUILDOZER.SPEC, changed android.api from 19 to 15 (just to see if this has any positive effects).
-
executed : rm -Rf .buildozer between each compiling attempt.
-
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.... -
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 =
-
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.

















Current Environment Specs :



- 

- Running Linux Mint 17.2 as a Virtual Box VM
- Buildozer Version : 0.35dev
- Cython Version : 0.25









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
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 :
-
< ?php
-
-
/* Create a new Imagick object */
-
$im = new Imagick() ;
-
-
/* Create empty canvas */
-
$im->newImage( 200, 200, "white", "png" ) ;
-
-
/* Create the object used to draw */
-
$draw = new ImagickDraw() ;
-
-
/* Set the button color.
-
Changing this value changes the color of the button */
-
$draw->setFillColor( "#4096EE" ) ;
-
-
/* Create the outer circle */
-
$draw->circle( 50, 50, 70, 70 ) ;
-
-
/* Create the smaller circle on the button */
-
$draw->setFillColor( "white" ) ;
-
-
/* Semi-opaque fill */
-
$draw->setFillAlpha( 0.2 ) ;
-
-
/* Draw the circle */
-
$draw->circle( 50, 50, 68, 68 ) ;
-
-
/* Set the font */
-
$draw->setFont( "./test1.ttf" ) ;
-
-
/* This is the alpha value used to annotate */
-
$draw->setFillAlpha( 0.17 ) ;
-
-
/* Draw a curve on the button with 17% opaque fill */
-
$draw->bezier( array(
-
array( "x" => 10 , "y" => 25 ),
-
array( "x" => 39, "y" => 49 ),
-
array( "x" => 60, "y" => 55 ),
-
array( "x" => 75, "y" => 70 ),
-
array( "x" => 100, "y" => 70 ),
-
array( "x" => 100, "y" => 10 ),
-
) ) ;
-
-
/* Render all pending operations on the image */
-
$im->drawImage( $draw ) ;
-
-
/* Set fill to fully opaque */
-
$draw->setFillAlpha( 1 ) ;
-
-
/* Set the font size to 30 */
-
$draw->setFontSize( 30 ) ;
-
-
/* The text on the */
-
$draw->setFillColor( "white" ) ;
-
-
/* Annotate the text */
-
$im->annotateImage( $draw, 38, 55, 0, "go" ) ;
-
-
/* Trim extra area out of the image */
-
$im->trimImage( 0 ) ;
-
-
/* Output the image */
-
header( "Content-Type : image/png" ) ;
-
echo $im ;
-
-
?>
And here is a few buttons I created by changing the fill color value :
-
-
Stream image from Android with FFMPEG
9 février 2023, par xnokI'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 :


public class MainActivity extends Activity {
 final String rtmp_url = "rtmp://192.168.0.12:1935/live/test";
 private int PREVIEW_WIDTH = 384;
 private int PREVIEW_HEIGHT = 292;
 private String TAG = "MainActivity";
 String ffmpeg = Loader.load(org.bytedeco.ffmpeg.ffmpeg.class);
 final String command[] = {ffmpeg,
 "-y", //Add "-re" for simulated readtime streaming.
 "-f", "rawvideo",
 "-vcodec", "rawvideo",
 "-pix_fmt", "bgr24",
 "-s", (Integer.toString(PREVIEW_WIDTH) + "x" + Integer.toString(PREVIEW_HEIGHT)),
 "-r", "10",
 "-i", "pipe:",
 "-c:v", "libx264",
 "-pix_fmt", "yuv420p",
 "-preset", "ultrafast",
 "-f", "flv",
 rtmp_url};
 
 private UVCCamera mUVCCamera;

public void handleStartPreview(Object surface) throws InterruptedException, IOException {
 Log.e(TAG, "handleStartPreview:mUVCCamera" + mUVCCamera + " mIsPreviewing:");
 if ((mUVCCamera == null)) return;
 Log.e(TAG, "handleStartPreview2 ");
 try {
 mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 26, 0, UVCCamera.DEFAULT_BANDWIDTH, 0);
 Log.e(TAG, "handleStartPreview3 mWidth: " + mWidth + "mHeight:" + mHeight);
 } catch (IllegalArgumentException e) {
 try {
 // fallback to YUV mode
 mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 26, UVCCamera.DEFAULT_PREVIEW_MODE, UVCCamera.DEFAULT_BANDWIDTH, 0);
 Log.e(TAG, "handleStartPreview4");
 } catch (IllegalArgumentException e1) {
 callOnError(e1);
 return;
 }
 }
 Log.e(TAG, "handleStartPreview: startPreview1");
 int result = mUVCCamera.startPreview();
 mUVCCamera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_RGBX);
 mUVCCamera.startCapture();
 Toast.makeText(MainActivity.this,"Camera Started",Toast.LENGTH_SHORT).show();
 ProcessBuilder pb = new ProcessBuilder(command);
 pb.redirectErrorStream(true);
 Process process = pb.start();
 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
 OutputStream writer = process.getOutputStream();
 byte img[] = new byte[192*108*3];
 for (int i = 0; i < 10; i++)
 {
 for (int y = 0; y < 108; y++)
 {
 for (int x = 0; x < 192; x++)
 {
 byte r = (byte)((x * y + i) % 255);
 byte g = (byte)((x * y + i*10) % 255);
 byte b = (byte)((x * y + i*20) % 255);
 img[(y*192 + x)*3] = b;
 img[(y*192 + x)*3+1] = g;
 img[(y*192 + x)*3+2] = r;
 }
 }

 writer.write(img);
 }

 writer.close();
 String line;
 while ((line = reader.readLine()) != null)
 {
 System.out.println(line);
 }

 process.waitFor();
}
public static void buildRawFrame(Mat img, int i)
{
 int p = img.cols() / 60;
 img.setTo(new Scalar(60, 60, 60));
 String text = Integer.toString(i+1);
 int font = Imgproc.FONT_HERSHEY_SIMPLEX;
 Point pos = new Point(img.cols()/2-p*10*(text.length()), img.rows()/2+p*10);
 Imgproc.putText(img, text, pos, font, p, new Scalar(255, 30, 30), p*2); //Blue number
}



Additionally : Android Camera Capture using FFmpeg


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.


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.


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


import cv2
import numpy as np
import socket
import sys
import pickle
import struct
import subprocess

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



I would like to do the same thing in Android


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


Process: com.infiRay.XthermMini, PID: 32089
 java.lang.NullPointerException
 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1012)
 at com.infiRay.XthermMini.MainActivity.handleStartPreview(MainActivity.java:512)
 at com.infiRay.XthermMini.MainActivity.startPreview(MainActivity.java:563)
 at com.infiRay.XthermMini.MainActivity.access$1000(MainActivity.java:49)
 at com.infiRay.XthermMini.MainActivity$3.onConnect(MainActivity.java:316)
 at com.serenegiant.usb.USBMonitor$3.run(USBMonitor.java:620)
 at android.os.Handler.handleCallback(Handler.java:938)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loopOnce(Looper.java:226)
 at android.os.Looper.loop(Looper.java:313)
 at android.os.HandlerThread.run(HandlerThread.java:67)
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
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
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
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
2022-06-02 11:47:20.312 32089-32089/com.infiRay.XthermMini E/MainActivity: onPause:
2022-06-02 11:47:20.314 32089-32581/com.infiRay.XthermMini I/Process: Sending signal. PID: 32089 SIG: 9