
Recherche avancée
Médias (91)
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Lights in the Sky
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Head Down
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Echoplex
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Discipline
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Letting You
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (103)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Le profil des utilisateurs
12 avril 2011, parChaque 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 (6692)
-
Duplicate class I'm already using ffmpeg_kit_flutter_audio in my code : 5.1.0-LTS for audio conversion video_editor : ^2.1.0
21 août 2024, par Rafael Dos Santos ColadeloI'm already using in my code : ffmpeg_kit_flutter_audio-5.1.0-LTS
for audio conversion, when you put the
video_editor : ^2.1.0
general the error, is there any way to solve it ?


FAILURE : Build failed with an exception.


- 

- What went wrong :
Execution failed for task ':app:checkDebugDuplicateClasses'.






A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class com.arthenica.ffmpegkit.Abi found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.AbiDetect found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.AbstractSession found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.AsyncFFmpegExecuteTask found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.AsyncFFprobeExecuteTask found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.AsyncGetMediaInformationTask found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.BuildConfig found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.CameraSupport found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.Chapter found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.FFmpegKit found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.FFmpegKitConfig found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.FFmpegKitConfig$1 found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.FFmpegKitConfig$2 found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.FFmpegKitConfig$SAFProtocolUrl found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.FFmpegSession found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.FFmpegSessionCompleteCallback found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.FFprobeKit found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.FFprobeSession found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.FFprobeSessionCompleteCallback found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.Level found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.Log found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.LogCallback found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.LogRedirectionStrategy found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.MediaInformation found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.MediaInformationJsonParser found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.MediaInformationSession found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.MediaInformationSessionCompleteCallback found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.NativeLoader found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.Packages found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.ReturnCode found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.Session found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.SessionState found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.Signal found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.Statistics found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.StatisticsCallback found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)
Duplicate class com.arthenica.ffmpegkit.StreamInformation found in modules jetified-ffmpeg-kit-audio-5.1.LTS-runtime (com.arthenica:ffmpeg-kit-audio:5.1.LTS) and jetified-ffmpeg-kit-min-gpl-5.1-runtime (com.arthenica:ffmpeg-kit-min-gpl:5.1)




Go to the documentation to learn how to <a href="http://stackoverflow.com/feeds/tag/d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.



- 

- Try :






Run with —stacktrace option to get the stack trace.
Run with —info or —debug option to get more log output.
Run with —scan to get full insights.




- 

- Get more help at https://help.gradle.org




BUILD FAILED in 6s
Exception : Gradle task assembleDebug failed with exit code 1




-
Convert Webm to MP4 on the fly using ffmpeg for a Telegram bot using Typescript
23 novembre 2022, par HexI'm trying to make a very primitive telegram bot that get's a json and uploads the urls that are in the json to telegram.


The problem is that there are urls that point to webm files I tried to see if there is a simple way to do this and I found this : https://www.npmjs.com/package/webm-to-mp4
but it doesn't seem to work sadly, it runs into this error : "






throw new Error(`Conversion error: ${stderr}`)
 ^

Error: Conversion error: ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
 built with emcc (Emscripten gcc/clang-like replacement) 1.39.11
 configuration: --cc=emcc --ranlib=emranlib --enable-cross-compile --target-os=none --arch=x86 --disable-runtime-cpudetect --disable-asm --disable-fast-unaligned --disable-pthreads --disable-w32threads --disable-os2threads --disable-debug --disable-stripping --disable-safe-bitstream-reader --disable-all --enable-ffmpeg --enable-avcodec --enable-avformat --enable-avfilter --enable-swresample --enable-swscale --disable-network --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --enable-decoder=vp8 --enable-decoder=h264 --enable-decoder=vorbis --enable-decoder=opus --enable-decoder=mp3 --enable-decoder=aac --enable-decoder=pcm_s16le --enable-decoder=mjpeg --enable-decoder=png --enable-demuxer=matroska --enable-demuxer=ogg --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=wav --enable-demuxer=image2 --enable-demuxer=concat --enable-protocol=file --enable-filter=aresample --enable-filter=scale --enable-filter=crop --enable-filter=overlay --enable-filter=hstack --enable-filter=vstack --disable-bzlib --disable-iconv --disable-libxcb --disable-lzma --disable-sdl2 --disable-securetransport --disable-xlib --enable-zlib --enable-encoder=libx264 --enable-encoder=libmp3lame --enable-encoder=aac --enable-muxer=mp4 --enable-muxer=mp3 --enable-muxer=null --enable-gpl --enable-libmp3lame --enable-libx264 --extra-cflags='-s USE_ZLIB=1 -I../lame/dist/include' --extra-ldflags=-L../lame/dist/lib
 libavutil 56. 31.100 / 56. 31.100
 libavcodec 58. 54.100 / 58. 54.100
 libavformat 58. 29.100 / 58. 29.100
 libavfilter 7. 57.100 / 7. 57.100
 libswscale 5. 5.100 / 5. 5.100
 libswresample 3. 5.100 / 3. 5.100
input.webm: Invalid data found when processing input
exception thrown: Error: Conversion error: ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
 built with emcc (Emscripten gcc/clang-like replacement) 1.39.11
 configuration: --cc=emcc --ranlib=emranlib --enable-cross-compile --target-os=none --arch=x86 --disable-runtime-cpudetect --disable-asm --disable-fast-unaligned --disable-pthreads --disable-w32threads --disable-os2threads --disable-debug --disable-stripping --disable-safe-bitstream-reader --disable-all --enable-ffmpeg --enable-avcodec --enable-avformat --enable-avfilter --enable-swresample --enable-swscale --disable-network --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --enable-decoder=vp8 --enable-decoder=h264 --enable-decoder=vorbis --enable-decoder=opus --enable-decoder=mp3 --enable-decoder=aac --enable-decoder=pcm_s16le --enable-decoder=mjpeg --enable-decoder=png --enable-demuxer=matroska --enable-demuxer=ogg --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=wav --enable-demuxer=image2 --enable-demuxer=concat --enable-protocol=file --enable-filter=aresample --enable-filter=scale --enable-filter=crop --enable-filter=overlay --enable-filter=hstack --enable-filter=vstack --disable-bzlib --disable-iconv --disable-libxcb --disable-lzma --disable-sdl2 --disable-securetransport --disable-xlib --enable-zlib --enable-encoder=libx264 --enable-encoder=libmp3lame --enable-encoder=aac --enable-muxer=mp4 --enable-muxer=mp3 --enable-muxer=null --enable-gpl --enable-libmp3lame --enable-libx264 --extra-cflags='-s USE_ZLIB=1 -I../lame/dist/include' --extra-ldflags=-L../lame/dist/lib
 libavutil 56. 31.100 / 56. 31.100
 libavcodec 58. 54.100 / 58. 54.100
 libavformat 58. 29.100 / 58. 29.100
 libavfilter 7. 57.100 / 7. 57.100
 libswscale 5. 5.100 / 5. 5.100
 libswresample 3. 5.100 / 3. 5.100
input.webm: Invalid data found when processing input
,Error: Conversion error: ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
 built with emcc (Emscripten gcc/clang-like replacement) 1.39.11
 configuration: --cc=emcc --ranlib=emranlib --enable-cross-compile --target-os=none --arch=x86 --disable-runtime-cpudetect --disable-asm --disable-fast-unaligned --disable-pthreads --disable-w32threads --disable-os2threads --disable-debug --disable-stripping --disable-safe-bitstream-reader --disable-all --enable-ffmpeg --enable-avcodec --enable-avformat --enable-avfilter --enable-swresample --enable-swscale --disable-network --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --enable-decoder=vp8 --enable-decoder=h264 --enable-decoder=vorbis --enable-decoder=opus --enable-decoder=mp3 --enable-decoder=aac --enable-decoder=pcm_s16le --enable-decoder=mjpeg --enable-decoder=png --enable-demuxer=matroska --enable-demuxer=ogg --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=wav --enable-demuxer=image2 --enable-demuxer=concat --enable-protocol=file --enable-filter=aresample --enable-filter=scale --enable-filter=crop --enable-filter=overlay --enable-filter=hstack --enable-filter=vstack --disable-bzlib --disable-iconv --disable-libxcb --disable-lzma --disable-sdl2 --disable-securetransport --disable-xlib --enable-zlib --enable-encoder=libx264 --enable-encoder=libmp3lame --enable-encoder=aac --enable-muxer=mp4 --enable-muxer=mp3 --enable-muxer=null --enable-gpl --enable-libmp3lame --enable-libx264 --extra-cflags='-s USE_ZLIB=1 -I../lame/dist/include' --extra-ldflags=-L../lame/dist/lib
 libavutil 56. 31.100 / 56. 31.100
 libavcodec 58. 54.100 / 58. 54.100
 libavformat 58. 29.100 / 58. 29.100
 libavfilter 7. 57.100 / 7. 57.100
 libswscale 5. 5.100 / 5. 5.100
 libswresample 3. 5.100 / 3. 5.100
input.webm: Invalid data found when processing input



I'm not sure what is causing it, my guess is that the webm-to.mp4 package was updated 2 years ago and something broke in the meantime.


Is there a better way to do this then downloading the webm converting it and then sending it up to telegram ? If not how could I do the conversion using just ffmpeg ?


Here is my current code :


import { Telegram, MediaSource, HTML } from 'puregram'
import { HearManager } from '@puregram/hear'
import { createReadStream } from 'fs'
import postsJson from './posts.json';
const { promises: fs } = require("fs");
const webmToMp4 = require("webm-to-mp4");

const telegram = new Telegram({
 token: '********:AAEzriis6zNNjEQuw0BxF9M2RPA9V4lEqLA'
})
const hearManager = new HearManager()

telegram.updates.startPolling()
 .then(() => console.log(`started polling @${telegram.bot.username}`))
 .catch(console.error)

telegram.updates.on('message', hearManager.middleware)

var posts = postsJson;

telegram.updates.on('message', (context) => {
 posts.forEach( async data => {
 console.error(data.ext);
 if(data.ext == "jpg" || data.ext == "png"){
 context.sendPhoto(MediaSource.url(data.image), { caption: data.content } );
 delay(1000);
 }
 if(data.ext == "gif"){
 context.sendAnimation(MediaSource.url(data.image), { caption: data.content } );
 delay(1000);
 }
 if(data.ext == "webm"){
 //context.sendDocument(MediaSource.url(data.image), { caption: data.content } );
 delay(1000);
 }
 delay(1000);
 })
})
fs.writeFile("file.mp4", Buffer.from(webmToMp4( fs.readFile("./file.webm"))));

function delay(ms: number) {
 return new Promise( resolve => setTimeout(resolve, ms) ); //This does not work either
}



I wish everoyne a nice day !


-
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