Recherche avancée

Médias (91)

Autres articles (103)

  • Les vidéos

    21 avril 2011, par

    Comme 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, par

    The 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, 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 (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 Coladelo

    I'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>.&#xA;

    &#xA;

      &#xA;
    • Try :
    • &#xA;

    &#xA;

    &#xA;

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

    &#xA;

    &#xA;

    &#xA;

    BUILD FAILED in 6s&#xA;Exception : Gradle task assembleDebug failed with exit code 1

    &#xA;

    &#xA;

  • Convert Webm to MP4 on the fly using ffmpeg for a Telegram bot using Typescript

    23 novembre 2022, par Hex

    I'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.

    &#xA;

    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&#xA;but it doesn't seem to work sadly, it runs into this error : "

    &#xA;

    &#xA;

    &#xA;

    throw new Error(`Conversion error: ${stderr}`)&#xA;                                ^&#xA;&#xA;Error: Conversion error: ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with emcc (Emscripten gcc/clang-like replacement) 1.39.11&#xA;  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=&#x27;-s USE_ZLIB=1 -I../lame/dist/include&#x27; --extra-ldflags=-L../lame/dist/lib&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;input.webm: Invalid data found when processing input&#xA;exception thrown: Error: Conversion error: ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with emcc (Emscripten gcc/clang-like replacement) 1.39.11&#xA;  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=&#x27;-s USE_ZLIB=1 -I../lame/dist/include&#x27; --extra-ldflags=-L../lame/dist/lib&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;input.webm: Invalid data found when processing input&#xA;,Error: Conversion error: ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with emcc (Emscripten gcc/clang-like replacement) 1.39.11&#xA;  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=&#x27;-s USE_ZLIB=1 -I../lame/dist/include&#x27; --extra-ldflags=-L../lame/dist/lib&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;input.webm: Invalid data found when processing input&#xA;

    &#xA;

    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.

    &#xA;

    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 ?

    &#xA;

    Here is my current code :

    &#xA;

    import { Telegram, MediaSource, HTML } from &#x27;puregram&#x27;&#xA;import { HearManager } from &#x27;@puregram/hear&#x27;&#xA;import { createReadStream } from &#x27;fs&#x27;&#xA;import postsJson from &#x27;./posts.json&#x27;;&#xA;const { promises: fs } = require("fs");&#xA;const webmToMp4 = require("webm-to-mp4");&#xA;&#xA;const telegram = new Telegram({&#xA;  token: &#x27;********:AAEzriis6zNNjEQuw0BxF9M2RPA9V4lEqLA&#x27;&#xA;})&#xA;const hearManager = new HearManager()&#xA;&#xA;telegram.updates.startPolling()&#xA;  .then(() => console.log(`started polling @${telegram.bot.username}`))&#xA;  .catch(console.error)&#xA;&#xA;telegram.updates.on(&#x27;message&#x27;, hearManager.middleware)&#xA;&#xA;var posts = postsJson;&#xA;&#xA;telegram.updates.on(&#x27;message&#x27;, (context) => {&#xA;    posts.forEach( async data => {&#xA;      console.error(data.ext);&#xA;        if(data.ext == "jpg" || data.ext == "png"){&#xA;          context.sendPhoto(MediaSource.url(data.image), { caption: data.content  } );&#xA;          delay(1000);&#xA;        }&#xA;        if(data.ext == "gif"){&#xA;          context.sendAnimation(MediaSource.url(data.image), { caption: data.content  } );&#xA;          delay(1000);&#xA;        }&#xA;        if(data.ext == "webm"){&#xA;          //context.sendDocument(MediaSource.url(data.image), { caption: data.content  } );&#xA;          delay(1000);&#xA;        }&#xA;        delay(1000);&#xA;    })&#xA;})&#xA;fs.writeFile("file.mp4", Buffer.from(webmToMp4( fs.readFile("./file.webm"))));&#xA;&#xA;function delay(ms: number) {&#xA;  return new Promise( resolve => setTimeout(resolve, ms) ); //This does not work either&#xA;}&#xA;

    &#xA;

    I wish everoyne a nice day !

    &#xA;

  • 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;