Recherche avancée

Médias (1)

Mot : - Tags -/iphone

Autres articles (42)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Diogene : création de masques spécifiques de formulaires d’édition de contenus

    26 octobre 2010, par

    Diogene est un des plugins ? SPIP activé par défaut (extension) lors de l’initialisation de MediaSPIP.
    A quoi sert ce plugin
    Création de masques de formulaires
    Le plugin Diogène permet de créer des masques de formulaires spécifiques par secteur sur les trois objets spécifiques SPIP que sont : les articles ; les rubriques ; les sites
    Il permet ainsi de définir en fonction d’un secteur particulier, un masque de formulaire par objet, ajoutant ou enlevant ainsi des champs afin de rendre le formulaire (...)

  • Configuration spécifique pour PHP5

    4 février 2011, par

    PHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
    Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
    Modules spécifiques
    Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...)

Sur d’autres sites (6797)

  • How to send libmmpeg AVPacket through WebRTC (using libdatachannel)

    29 mars 2022, par mike

    I'm encoding a video frame with the ffmpeg libraries, generating an AVPacket with compressed data.

    


    Thanks to some recent advice here on S/O, I am trying to send that frame over a network using the WebRTC library libdatachannel, specifically by adapting the example here :

    


    https://github.com/paullouisageneau/libdatachannel/tree/master/examples/streamer

    


    I am seeing problems inside h264rtppacketizer.cpp (part of the library, not the example) which are almost certainly to do with how I'm providing the sample data.
(I don't think that this is anything to do with libdatachannel specifically, it will be an issue with what I'm sending)

    


    The example code reads each encoded frame from a file, and populates a sample by setting the content of the file to the contents of the file :

    


    sample = *reinterpret_cast *>(&fileContents);

    


    sample is just a std::vector<byte>;</byte>

    &#xA;

    I have naively copied the contents of an AVPacket->data pointer into the sample vector :

    &#xA;

    sample.resize(pkt->size);&#xA;memcpy(sample.data(), pkt->data, pkt->size * sizeof(std::byte));    &#xA;

    &#xA;

    but the packetizer is falling over when trying to get length values out of that data.&#xA;Specifically, in the following code, the first iteration gets a length of 1, but the second, looking up index 5, gives 1119887324. This is way too big for my data, which is only 3526 bytes (the whole frame is a single colour so likely to be small once encoded) :

    &#xA;

    while (index &lt; message->size()) {&#xA;assert(index &#x2B; 4 &lt; message->size());&#xA;auto lengthPtr = (uint32_t *)(message->data() &#x2B; index);&#xA;uint32_t length = ntohl(*lengthPtr);&#xA;auto naluStartIndex = index &#x2B; 4;&#xA;auto naluEndIndex = naluStartIndex &#x2B; length;&#xA;assert(naluEndIndex &lt;= message->size());    &#xA;        &#xA;auto begin = message->begin() &#x2B; naluStartIndex;&#xA;auto end = message->begin() &#x2B; naluEndIndex;&#xA;nalus->push_back(std::make_shared<nalunit>(begin, end));&#xA;index = naluEndIndex;&#xA;}&#xA;</nalunit>

    &#xA;

    Here is a dump of

    &#xA;

    uint32_t length = ntohl(*lengthPtr);&#xA;

    &#xA;

    for the first few elements of the message (*lengthPtr in parentheses) :

    &#xA;

    [2022-03-29 15:12:01.182] [info] index 0: 1  (16777216)&#xA;[2022-03-29 15:12:01.183] [info] index 1: 359  (1728118784)&#xA;[2022-03-29 15:12:01.184] [info] index 2: 91970  (1114046720)&#xA;[2022-03-29 15:12:01.186] [info] index 3: 23544512  (3225577217)&#xA;[2022-03-29 15:12:01.186] [info] index 4: 1732427807  (532693607)&#xA;[2022-03-29 15:12:01.187] [info] index 5: 1119887324  (3693068354)&#xA;[2022-03-29 15:12:01.188] [info] index 6: 3223313413  (98312128)&#xA;[2022-03-29 15:12:01.188] [info] index 7: 534512896  (384031)&#xA;[2022-03-29 15:12:01.188] [info] index 8: 3691315291  (1526728156)&#xA;[2022-03-29 15:12:01.189] [info] index 9: 83909537  (2707095557)&#xA;[2022-03-29 15:12:01.189] [info] index 10: 6004992  (10574592)&#xA;[2022-03-29 15:12:01.190] [info] index 11: 1537277952  (41307)&#xA;[2022-03-29 15:12:01.190] [info] index 12: 2701131779  (50331809)&#xA;[2022-03-29 15:12:01.192] [info] index 13: 768  (196608)&#xA;

    &#xA;

    (I know I should post a complete sample, I am working on it)

    &#xA;

      &#xA;
    • I am fairly sure I am just missing something basic. E.g. am I supposed to do something with the AVPacket side_data, does AVPacket have or miss some header info ?

      &#xA;

    • &#xA;

    • If I just fwrite the pkt->data for a single frame to disk, I can read the codec information with ffprobe :

      &#xA;

    • &#xA;

    &#xA;

    Input #0, h264, from &#x27;encodedOut.h264&#x27;:&#xA;Duration: N/A, bitrate: N/A&#xA;Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(progressive), 1280x720, 30 tbr, 1200k tbn&#xA;

    &#xA;

      &#xA;
    • whereas the same for the example input files (again a single frame) gives the following :
    • &#xA;

    &#xA;

    [h264 @ 000001c88d1135c0] Format h264 detected only with low score of 1, misdetection possible!&#xA;[h264 @ 000001c88f337400] missing picture in access unit with size 85306&#xA;[extract_extradata @ 000001c88d11ee40] No start code is found.&#xA;sample-0.h264: Invalid data found when processing input&#xA;

    &#xA;

  • Android FFMPEG video editing operation failed

    30 mai 2022, par Bipin Vayalu

    I am using FFMPEG in my Android app for video cropping and trimming but when I execute the following command on a specific video. FFMPEG command execution failed and the app crashed.

    &#xA;

    Command :

    &#xA;

    ffmpeg -y -i "/storage/emulated/0/DCIM/Camera/Test-Video.mp4" -crf 19 -color_primaries 1 -color_trc 1 -colorspace 1 -vcodec h264 -acodec aac -ss 00:00:00 -t 00:00:15 -async 1 -vf "crop=540:539:0:0:exact=0 , scale=&#x27;if(gt(iw,ih),min(640,iw),-2)&#x27;:&#x27;if(gt(iw,ih),-2,min(640,ih))&#x27;" "/data/user/0/com.bipin.myapp/cache/Test-Video_16535454525974982000318197164476.mp4"&#xA;

    &#xA;

    Failure logs :

    &#xA;

    2022-05-26 11:40:52.605 5308-9484/com.bipin.myapp D/[RxCachedThreadScheduler-11;FFmpegUtil#performVideoOperation:151]: Debug - performVideoOperation - Source File: Test-Video.mp4, size: 9.697972297668457 MBs&#xA;2022-05-26 11:40:52.605 5308-9484/com.bipin.myapp D/[RxCachedThreadScheduler-11;FFmpegUtil#performVideoOperation:159]: Debug - performVideoOperation - Command: -y -i "/storage/emulated/0/DCIM/Camera/Test-Video.mp4" -crf 19 -color_primaries 1 -color_trc 1 -colorspace 1 -vcodec h264 -acodec aac -ss 00:00:00 -t 00:00:15 -async 1 -vf "crop=540:539:0:0:exact=0 , scale=&#x27;if(gt(iw,ih),min(640,iw),-2)&#x27;:&#x27;if(gt(iw,ih),-2,min(640,ih))&#x27;" "/data/user/0/com.bipin.myapp/cache/Test-Video_16535454525974982000318197164476.mp4"&#xA;2022-05-26 11:40:52.607 5308-9484/com.bipin.myapp I/mobile-ffmpeg: Loading mobile-ffmpeg.&#xA;2022-05-26 11:40:52.617 5308-9484/com.bipin.myapp I/mobile-ffmpeg: Loaded mobile-ffmpeg-min-gpl-arm64-v8a-4.4-lts-20200724.&#xA;2022-05-26 11:40:52.619 5308-9485/com.bipin.myapp D/mobile-ffmpeg: Callback thread started.&#xA;2022-05-26 11:40:52.620 5308-9485/com.bipin.myapp I/mobile-ffmpeg: ffmpeg version v4.4-dev-416&#xA;2022-05-26 11:40:52.620 5308-9485/com.bipin.myapp I/mobile-ffmpeg:  Copyright (c) 2000-2020 the FFmpeg developers&#xA;2022-05-26 11:40:52.620 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.620 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn)&#xA;2022-05-26 11:40:52.620 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   configuration: --cross-prefix=aarch64-linux-android- --sysroot=/files/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8-a --cc=aarch64-linux-android21-clang --cxx=aarch64-linux-android21-clang&#x2B;&#x2B; --extra-libs=&#x27;-L/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/cpu-features/lib -lndk_compat&#x27; --target-os=android --enable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libx264 --enable-gpl --enable-libxvid --enable-gpl --enable-libx265 --enable-gpl --enable-libvidstab --enable-gpl --disable-sdl2 --enable-zlib --enable-mediacodec&#xA;2022-05-26 11:40:52.621 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   libavutil      56. 55.100 / 56. 55.100&#xA;2022-05-26 11:40:52.621 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   libavcodec     58. 96.100 / 58. 96.100&#xA;2022-05-26 11:40:52.621 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   libavformat    58. 48.100 / 58. 48.100&#xA;2022-05-26 11:40:52.622 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   libavdevice    58. 11.101 / 58. 11.101&#xA;2022-05-26 11:40:52.622 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   libavfilter     7. 87.100 /  7. 87.100&#xA;2022-05-26 11:40:52.622 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   libswscale      5.  8.100 /  5.  8.100&#xA;2022-05-26 11:40:52.622 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   libswresample   3.  8.100 /  3.  8.100&#xA;2022-05-26 11:40:52.638 5308-5308/com.bipin.myapp D/InputMethodManager: startInputInner - Id : 0&#xA;2022-05-26 11:40:52.638 5308-5308/com.bipin.myapp I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus&#xA;2022-05-26 11:40:52.645 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;/storage/emulated/0/DCIM/Camera/Test-Video.mp4&#x27;:&#xA;2022-05-26 11:40:52.645 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   Metadata:&#xA;2022-05-26 11:40:52.645 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     major_brand     : &#xA;2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: mp42&#xA;2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     minor_version   : &#xA;2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 1&#xA;2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     compatible_brands: &#xA;2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: isommp41mp42&#xA;2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     creation_time   : &#xA;2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 2022-04-05T14:20:18.000000Z&#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   Duration: &#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 00:00:15.48&#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: , start: &#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 0.000000&#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: , bitrate: &#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 5255 kb/s&#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     Stream #0:0&#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: (und)&#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: : Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 540x960, 5251 kb/s&#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: , &#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 30.04 fps, &#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 30 tbr, &#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 600 tbn, &#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 1200 tbc&#xA;2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg:  (default)&#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     Metadata:&#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg:       creation_time   : &#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 2022-04-05T14:20:18.000000Z&#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg:       handler_name    : &#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Core Media Video&#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Stream mapping:&#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   Stream #0:0 -> #0:0&#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg:  (h264 (native) -> h264 (libx264))&#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Press [q] to stop, [?] for help&#xA;2022-05-26 11:40:52.673 5308-9485/com.bipin.myapp W/mobile-ffmpeg: [graph 0 input from stream 0:0 @ 0xb400007bf58e0ed0] sws_param option is deprecated and ignored&#xA;2022-05-26 11:40:52.674 5308-9485/com.bipin.myapp I/mobile-ffmpeg: [libx264 @ 0xb400007c65974720] using cpu capabilities: ARMv8 NEON&#xA;2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: [libx264 @ 0xb400007c65974720] profile High, level 3.0, 4:2:0, 8-bit&#xA;2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: [libx264 @ 0xb400007c65974720] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=19.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00&#xA;2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Output #0, mp4, to &#x27;/data/user/0/com.bipin.myapp/cache/Test-Video_16535454525974982000318197164476.mp4&#x27;:&#xA;2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg:   Metadata:&#xA;2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     major_brand     : &#xA;2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: mp42&#xA;2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     minor_version   : &#xA;2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 1&#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     compatible_brands: &#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: isommp41mp42&#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     encoder         : &#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Lavf58.48.100&#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     Stream #0:0&#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: (und)&#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: : Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(bt709), 540x538, q=-1--1&#xA;2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: , &#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 30 fps, &#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 15360 tbn, &#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 30 tbc&#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg:  (default)&#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     Metadata:&#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg:       creation_time   : &#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 2022-04-05T14:20:18.000000Z&#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg:       handler_name    : &#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Core Media Video&#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg:       encoder         : &#xA;2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Lavc58.96.100 libx264&#xA;2022-05-26 11:40:52.681 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.681 5308-9485/com.bipin.myapp I/mobile-ffmpeg:     Side data:&#xA;2022-05-26 11:40:52.681 5308-9485/com.bipin.myapp I/mobile-ffmpeg:       &#xA;2022-05-26 11:40:52.681 5308-9485/com.bipin.myapp I/mobile-ffmpeg: cpb: &#xA;2022-05-26 11:40:52.682 5308-9485/com.bipin.myapp I/mobile-ffmpeg: bitrate max/min/avg: 0/0/0 buffer size: 0 &#xA;2022-05-26 11:40:52.684 5308-9485/com.bipin.myapp I/mobile-ffmpeg: vbv_delay: N/A&#xA;2022-05-26 11:40:52.684 5308-9485/com.bipin.myapp I/mobile-ffmpeg: &#xA;2022-05-26 11:40:52.797 5308-5308/com.bipin.myapp D/[main;BaseDaggerFragment#onDestroyView:90]: Debug - PostMediaTabFragment onDestroyView called&#xA;2022-05-26 11:40:52.798 5308-5308/com.bipin.myapp D/[main;ViewBindingBaseFragment#onDestroyView:32]: Debug - PostMediaTabFragment onDestroyView called&#xA;2022-05-26 11:40:52.895 5308-9521/com.bipin.myapp A/libc: Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xb400007a53e6d000 in tid 9521 (RxCachedThreadS), pid 5308 (com.bipin.myapp)&#xA;2022-05-26 11:40:54.302 9524-9524/? A/DEBUG: Cmdline: com.bipin.myapp&#xA;2022-05-26 11:40:54.302 9524-9524/? A/DEBUG: pid: 5308, tid: 9521, name: RxCachedThreadS  >>> com.bipin.myapp &lt;&lt;&lt;&#xA;2022-05-26 11:40:54.302 9524-9524/? A/DEBUG:       #00 pc 000000000058b8d0  /data/app/~~QE7_ItG7A3ZSxt4PIZf-2w==/com.bipin.myapp-o6_afbhi9zItP6DEnUAd6w==/base.apk!libavcodec.so&#xA;2022-05-26 11:40:54.398 1189-1447/? W/ActivityManager: Missing app error report, app = com.bipin.myapp crashing = true notResponding = false&#xA;2022-05-26 11:40:54.407 1189-9530/? W/ActivityManager: crash : com.bipin.myapp,10342&#xA;

    &#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;