
Recherche avancée
Médias (3)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (36)
-
Menus personnalisés
14 novembre 2010, parMediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
Menus créés à l’initialisation du site
Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...) -
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
-
D’autres logiciels intéressants
12 avril 2011, parOn ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
Videopress
Site Internet : (...)
Sur d’autres sites (6727)
-
Android FFMPEG video editing operation failed
30 mai 2022, par Bipin VayaluI 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.


Command :


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='if(gt(iw,ih),min(640,iw),-2)':'if(gt(iw,ih),-2,min(640,ih))'" "/data/user/0/com.bipin.myapp/cache/Test-Video_16535454525974982000318197164476.mp4"



Failure logs :


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
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='if(gt(iw,ih),min(640,iw),-2)':'if(gt(iw,ih),-2,min(640,ih))'" "/data/user/0/com.bipin.myapp/cache/Test-Video_16535454525974982000318197164476.mp4"
2022-05-26 11:40:52.607 5308-9484/com.bipin.myapp I/mobile-ffmpeg: Loading mobile-ffmpeg.
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.
2022-05-26 11:40:52.619 5308-9485/com.bipin.myapp D/mobile-ffmpeg: Callback thread started.
2022-05-26 11:40:52.620 5308-9485/com.bipin.myapp I/mobile-ffmpeg: ffmpeg version v4.4-dev-416
2022-05-26 11:40:52.620 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Copyright (c) 2000-2020 the FFmpeg developers
2022-05-26 11:40:52.620 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
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)
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++ --extra-libs='-L/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/cpu-features/lib -lndk_compat' --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
2022-05-26 11:40:52.621 5308-9485/com.bipin.myapp I/mobile-ffmpeg: libavutil 56. 55.100 / 56. 55.100
2022-05-26 11:40:52.621 5308-9485/com.bipin.myapp I/mobile-ffmpeg: libavcodec 58. 96.100 / 58. 96.100
2022-05-26 11:40:52.621 5308-9485/com.bipin.myapp I/mobile-ffmpeg: libavformat 58. 48.100 / 58. 48.100
2022-05-26 11:40:52.622 5308-9485/com.bipin.myapp I/mobile-ffmpeg: libavdevice 58. 11.101 / 58. 11.101
2022-05-26 11:40:52.622 5308-9485/com.bipin.myapp I/mobile-ffmpeg: libavfilter 7. 87.100 / 7. 87.100
2022-05-26 11:40:52.622 5308-9485/com.bipin.myapp I/mobile-ffmpeg: libswscale 5. 8.100 / 5. 8.100
2022-05-26 11:40:52.622 5308-9485/com.bipin.myapp I/mobile-ffmpeg: libswresample 3. 8.100 / 3. 8.100
2022-05-26 11:40:52.638 5308-5308/com.bipin.myapp D/InputMethodManager: startInputInner - Id : 0
2022-05-26 11:40:52.638 5308-5308/com.bipin.myapp I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2022-05-26 11:40:52.645 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/DCIM/Camera/Test-Video.mp4':
2022-05-26 11:40:52.645 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Metadata:
2022-05-26 11:40:52.645 5308-9485/com.bipin.myapp I/mobile-ffmpeg: major_brand : 
2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: mp42
2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: minor_version : 
2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 1
2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: compatible_brands: 
2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: isommp41mp42
2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: creation_time : 
2022-05-26 11:40:52.646 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 2022-04-05T14:20:18.000000Z
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Duration: 
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 00:00:15.48
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: , start: 
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 0.000000
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: , bitrate: 
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 5255 kb/s
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Stream #0:0
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: (und)
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
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: , 
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 30.04 fps, 
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 30 tbr, 
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 600 tbn, 
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 1200 tbc
2022-05-26 11:40:52.647 5308-9485/com.bipin.myapp I/mobile-ffmpeg: (default)
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Metadata:
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: creation_time : 
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 2022-04-05T14:20:18.000000Z
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: handler_name : 
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Core Media Video
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Stream mapping:
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Stream #0:0 -> #0:0
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: (h264 (native) -> h264 (libx264))
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.648 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Press [q] to stop, [?] for help
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
2022-05-26 11:40:52.674 5308-9485/com.bipin.myapp I/mobile-ffmpeg: [libx264 @ 0xb400007c65974720] using cpu capabilities: ARMv8 NEON
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
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
2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Output #0, mp4, to '/data/user/0/com.bipin.myapp/cache/Test-Video_16535454525974982000318197164476.mp4':
2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Metadata:
2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: major_brand : 
2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: mp42
2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: minor_version : 
2022-05-26 11:40:52.678 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 1
2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: compatible_brands: 
2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: isommp41mp42
2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: encoder : 
2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Lavf58.48.100
2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Stream #0:0
2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: (und)
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
2022-05-26 11:40:52.679 5308-9485/com.bipin.myapp I/mobile-ffmpeg: , 
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 30 fps, 
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 15360 tbn, 
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 30 tbc
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: (default)
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Metadata:
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: creation_time : 
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 2022-04-05T14:20:18.000000Z
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: handler_name : 
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Core Media Video
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: encoder : 
2022-05-26 11:40:52.680 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Lavc58.96.100 libx264
2022-05-26 11:40:52.681 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.681 5308-9485/com.bipin.myapp I/mobile-ffmpeg: Side data:
2022-05-26 11:40:52.681 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.681 5308-9485/com.bipin.myapp I/mobile-ffmpeg: cpb: 
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 
2022-05-26 11:40:52.684 5308-9485/com.bipin.myapp I/mobile-ffmpeg: vbv_delay: N/A
2022-05-26 11:40:52.684 5308-9485/com.bipin.myapp I/mobile-ffmpeg: 
2022-05-26 11:40:52.797 5308-5308/com.bipin.myapp D/[main;BaseDaggerFragment#onDestroyView:90]: Debug - PostMediaTabFragment onDestroyView called
2022-05-26 11:40:52.798 5308-5308/com.bipin.myapp D/[main;ViewBindingBaseFragment#onDestroyView:32]: Debug - PostMediaTabFragment onDestroyView called
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)
2022-05-26 11:40:54.302 9524-9524/? A/DEBUG: Cmdline: com.bipin.myapp
2022-05-26 11:40:54.302 9524-9524/? A/DEBUG: pid: 5308, tid: 9521, name: RxCachedThreadS >>> com.bipin.myapp <<<
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
2022-05-26 11:40:54.398 1189-1447/? W/ActivityManager: Missing app error report, app = com.bipin.myapp crashing = true notResponding = false
2022-05-26 11:40:54.407 1189-9530/? W/ActivityManager: crash : com.bipin.myapp,10342



-
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



-
ffmpeg Undefined referance to several swr functions [duplicate]
21 mai 2022, par user19068953I'm trying to staticly link ffmpeg to my project, i downloaded the ffmpeg source files from a github repo because it had pre writen cmake files, which i needed for this exact problem but it changed nothing (https://github.com/Pawday/ffmpeg-cmake). I edited the file a little and posted it below, and added them to lib/ffmpeg in my project directory. I first ran ./configure, then ran make, then make install like the install guide suggested. Then i ran cmake . followed by make. It compiled just fine and i ran a test without any errors :


extern "C"{
 #include <libavcodec></libavcodec>avcodec.h>
}

#include <iostream>
int main(int argc, char* argv[]) {
 if (argc < 2) {
 std::cout << "provide a filename" << std::endl;
 return -1;
 AVPacket *pkt = av_packet_alloc();
 }
}
</iostream>


I was following the examples that ffmpeg provides, so i added this :


const AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO);



But now i have this huge error :


/usr/bin/ld: /usr/local/lib/libavcodec.a(opusdec.o): in function 

`opus_decode_subpacket':
/home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:346: undefined reference to `swr_is_initialized'
/usr/bin/ld: /usr/local/lib/libavcodec.a(opusdec.o): in function `opus_decode_frame':
/home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:188: undefined reference to `swr_is_initialized'
/usr/bin/ld: /usr/local/lib/libavcodec.a(opusdec.o): in function `opus_init_resample':
/home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:136: undefined reference to `swr_init'
/usr/bin/ld: /home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:142: undefined reference to `swr_convert'
/usr/bin/ld: /usr/local/lib/libavcodec.a(opusdec.o): in function `opus_decode_frame':
/home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:202: undefined reference to `swr_convert'
/usr/bin/ld: /usr/local/lib/libavcodec.a(opusdec.o): in function `opus_flush_resample':
/home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:90: undefined reference to `swr_convert'
/usr/bin/ld: /usr/local/lib/libavcodec.a(opusdec.o): in function `opus_decode_subpacket':
/home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:379: undefined reference to `swr_close'
/usr/bin/ld: /home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:346: undefined reference to `swr_is_initialized'
/usr/bin/ld: /usr/local/lib/libavcodec.a(opusdec.o): in function `opus_decode_flush':
/home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:582: undefined reference to `swr_close'
/usr/bin/ld: /usr/local/lib/libavcodec.a(opusdec.o): in function `opus_decode_close':
/home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:607: undefined reference to `swr_free'
/usr/bin/ld: /usr/local/lib/libavcodec.a(opusdec.o): in function `opus_decode_init':
/home/t/Desktop/Code/lib/ffmpeg/libavcodec/opusdec.c:660: undefined reference to `swr_alloc'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/Interview.dir/build.make:122: bin/Interview] Error 1
make[1]: *** [CMakeFiles/Makefile2:420: CMakeFiles/Interview.dir/all] Error 2
make: *** [Makefile:84: all] Error 2



I find some questions with similar issues to no avail :


FFmpeg seems to be version conflict
Linking libavcodec and libavformat : Undefined references


NOTE : previously i tried downloading ffmpeg with home-brew and pkg-config maybe that is causing an error, but my guess is my cmake file is faulty.


project/CMakeLists :


cmake_minimum_required(VERSION 3.14)

project(Interview C CXX)
set(CMAKE_CXX_STANDARD 14)

SET( EXECUTABLE_OUTPUT_PATH ${dir}/bin )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin )
set( CMAKE_C_FLAGS "-lswresample")

add_subdirectory(lib/ffmpeg)

add_definitions(-DGL_SILENCE_DEPRECATION)

list(APPEND SOURCES
 src/main.cpp
 src/vipch.h
 src/VideoDecoder.cpp
 src/VideoDecoder.h
 src/Application.cpp
 src/Application.h
 #src/OpenGLRenderer.cpp
 #src/OpenGLRenderer.h
 #src/Layer.h
 #src/Layer.cpp
)

find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h)
find_library(AVCODEC_LIBRARY avcodec)

find_path(AVFORMAT_INCLUDE_DIR libavformat/avformat.h)
find_library(AVFORMAT_LIBRARY avformat)

find_path(AVDEVICE_INCLUDE_DIR libavdevice/avdevice.h)
find_library(AVDEVICE_LIBRARY avdevice)

find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h)
find_library(AVCODEC_LIBRARY avcodec)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

add_executable(Interview src/main.cpp src/Application.cpp src/Application.h ${SOURCES})

target_link_libraries(Interview PRIVATE Threads::Threads)

if(APPLE)
 list(APPEND EXTRA_LIBS
 "-framework OpenGL"
 )

 configure_file(
 ${CMAKE_CURRENT_SOURCE_DIR}/assets/MacOSXBundleInfo.plist.in
 ${CMAKE_CURRENT_BINARY_DIR}/assets/MacOSXBundleInfo.plist
 )

 set_target_properties(Interview PROPERTIES
 MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/assets/MacOSXBundleInfo.plist
 )

elseif(WIN32)
 list(APPEND EXTRA_LIBS
 "-lglu32 -lopengl32"
 )
 set(CMAKE_EXE_LINKER_FLAGS "-std=gnu99 -static -static-libgcc -static-libstdc++ -mwindows")

endif()

list(APPEND EXTRA_LIBS
"-lGL -lGLU -lX11 -lz -lva -lswresample"
)

find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)

#target_link_libraries(Interview ${CORELIBS})


target_include_directories(Interview PRIVATE 
 ${AVCODEC_INCLUDE_DIR} 
 ${AVFORMAT_INCLUDE_DIR}
 ${AVUTIL_INCLUDE_DIR}
 ${AVDEVICE_INCLUDE_DIR} 
 ${OPENGL_INCLUDE_DIR}
 ${GLEW_INCLUDE_DIRS}
)

target_link_libraries(Interview PRIVATE 
 ${AVCODEC_LIBRARY} 
 ${AVFORMAT_LIBRARY} 
 ${AVUTIL_LIBRARY} 
 ${AVDEVICE_LIBRARY} 
 ${OPENGL_LIBRARY}
 ${GLEW_LIBRARIES}
)



NOTE : i previously had a really similar error with pthread but with some fixes to cmake and installing pthread i fixed it.


project/lib/ffmpeg/CMakeLists :


cmake_minimum_required(VERSION 3.15)

project(FFMPEG C CXX)

add_library(ffmpeg_config INTERFACE)

#TODO:[cmake] COMMON DEFINES (config.h)
# create list with all that and then pick required from that list in each target
target_compile_definitions(ffmpeg_config INTERFACE FFMPEG_CONFIGURATION="")
target_compile_definitions(ffmpeg_config INTERFACE FFMPEG_DATADIR="")
target_compile_definitions(ffmpeg_config INTERFACE AVCONV_DATADIR="")
target_compile_definitions(ffmpeg_config INTERFACE FFMPEG_LICENSE="")

target_compile_definitions(ffmpeg_config INTERFACE CC_IDENT="")

target_compile_definitions(ffmpeg_config INTERFACE HAVE_THREADS=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_PTHREADS=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_W32THREADS=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_OS2THREADS=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_ISNAN=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_MMXEXT=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_MMX2=HAVE_MMXEXT)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_MMX2=HAVE_MMXEXT)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_MMX_INLINE=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_MMX=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_AV_CONFIG_H=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_ALTIVEC=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_MMXEXT_INLINE=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_NEON=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_AMD3DNOW_INLINE=0)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_X86ASM=0)
if(WIN32)
 target_compile_definitions(ffmpeg_config INTERFACE HAVE_MKSTEMP=0)
else()
 target_compile_definitions(ffmpeg_config INTERFACE HAVE_MKSTEMP=1)
endif()


#TODO:[cmake] detect each function and set to 0 if missing (they are in math.h)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_CBRT=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_CBRTF=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_COPYSIGN=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_ERF=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_HYPOT=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_RINT=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_LRINT=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_LRINTF=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_ROUND=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_ROUNDF=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_TRUNC=1)
target_compile_definitions(ffmpeg_config INTERFACE HAVE_TRUNCF=1)


target_link_libraries(ffmpeg_config INTERFACE ffmpeg_compat)

include (TestBigEndian)
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
if(IS_BIG_ENDIAN)
 target_compile_definitions(ffmpeg_config INTERFACE HAVE_BIGENDIAN=1)
else()
 target_compile_definitions(ffmpeg_config INTERFACE HAVE_BIGENDIAN=0)
endif()

target_compile_definitions(ffmpeg_config INTERFACE av_restrict=)

target_compile_definitions(ffmpeg_config INTERFACE CONFIG_THIS_YEAR=2021)

target_compile_definitions(ffmpeg_config INTERFACE CONFIG_MEMORY_POISONING=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_FRAME_THREAD_ENCODER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_MEMORY_POISONING=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_GRAY=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_ERROR_RESILIENCE=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_MPEGVIDEODEC=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_SMALL=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_H264_D3D11VA_HWACCEL=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_H264_DXVA2_HWACCEL=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_H264_NVDEC_HWACCEL=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_H264_VAAPI_HWACCEL=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_H264_VIDEOTOOLBOX_HWACCEL=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_H264_VDPAU_HWACCEL=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_NETWORK=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_XVMC=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_FORMAT_FILTER=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_PNG_DECODER=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_APNG_DECODER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_INFLATE_WRAPPER=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_DEFLATE_WRAPPER=1)

target_compile_definitions(ffmpeg_config INTERFACE CONFIG_AVUTIL=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_AVCODEC=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_AVFORMAT=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_AVDEVICE=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_SWSCALE=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_SWRESAMPLE=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_POSTPROC=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_AVFILTER=1)



#CONFIG MUXERS
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_H264_MUXER=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE2_MUXER=1)

#CONFIG DEMUXERS
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE2_DEMUXER=1)

# look at the end of libavformat/img2dec.c file
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_BMP_PIPE_DEMUXER=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_CRI_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_DDS_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_DPX_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_EXR_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_GEM_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_GIF_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_J2K_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_JPEG_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PAM_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PBM_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PCX_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PGM_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PGX_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PHOTOCD_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PICTOR_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PNG_PIPE_DEMUXER=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PPM_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_PSD_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_QDRAW_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_SGI_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_SVG_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_TIFF_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_WEBP_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_XBM_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_XPM_PIPE_DEMUXER=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_IMAGE_XWD_PIPE_DEMUXER=0)


#CONFIG PROTOCOLS
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_FILE_PROTOCOL=1)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_PIPE_PROTOCOL=1)

target_compile_definitions(ffmpeg_config INTERFACE CONFIG_ZLIB=0)
target_compile_definitions(ffmpeg_config INTERFACE CONFIG_SWSCALE_ALPHA=0)

target_compile_definitions(ffmpeg_config INTERFACE ARCH_X86_32=0)
target_compile_definitions(ffmpeg_config INTERFACE ARCH_X86_64=0)
target_compile_definitions(ffmpeg_config INTERFACE ARCH_AARCH64=0)
target_compile_definitions(ffmpeg_config INTERFACE ARCH_ARM=0)
target_compile_definitions(ffmpeg_config INTERFACE ARCH_PPC=0)
target_compile_definitions(ffmpeg_config INTERFACE ARCH_X86=0)
target_compile_definitions(ffmpeg_config INTERFACE ARCH_MIPS=0)
target_compile_definitions(ffmpeg_config INTERFACE ARCH_ALPHA=0)
target_compile_definitions(ffmpeg_config INTERFACE ARCH_LOONGARCH=0)
target_compile_definitions(ffmpeg_config INTERFACE ARCH_LOONGARCH64=0)

target_compile_definitions(ffmpeg_config INTERFACE SWS_MAX_FILTER_SIZE=256)

#_________________________WARNINGS__________________________________________
#TODO[cmake]: set it for all targets individually or remove for WARNING HELL
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
 add_compile_options("-w")
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 add_compile_options("-w")
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
 cmake_policy(SET CMP0092 NEW) #cmake disable std MSVC warnings in CMAKE_C_FLAGS
 #CMAKE_DEPFILE_FLAGS_C var in windows contains only /showIncludes and produce include tree
 set(CMAKE_DEPFILE_FLAGS_C "") #erase it
 add_compile_options("/w")
endif()

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/include/config.h "//cmake config will define all that")
target_include_directories(ffmpeg_config INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/include)

#TODO[cmake]: resolve config_components.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/include/config_components.h "//")
target_include_directories(ffmpeg_config INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/include)

add_subdirectory(compat)
add_subdirectory(libavutil)
add_subdirectory(libavcodec)
add_subdirectory(libavformat)
add_subdirectory(libavdevice)
add_subdirectory(libavfilter)
add_subdirectory(libswresample)
add_subdirectory(libswscale)
add_subdirectory(libpostproc)

add_subdirectory(fftools)

add_subdirectory(doc/examples)


find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h)
find_library(AVCODEC_LIBRARY avcodec)

find_path(AVFORMAT_INCLUDE_DIR libavformat/avformat.h)
find_library(AVFORMAT_LIBRARY avformat)

find_path(AVDEVICE_INCLUDE_DIR libavdevice/avdevice.h)
find_library(AVDEVICE_LIBRARY avdevice)

find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h)
find_library(AVCODEC_LIBRARY avcodec)

if(APPLE)
 list(APPEND EXTRA_LIBS
 "-framework OpenGL"
 )

 configure_file(
 ${CMAKE_CURRENT_SOURCE_DIR}/assets/MacOSXBundleInfo.plist.in
 ${CMAKE_CURRENT_BINARY_DIR}/assets/MacOSXBundleInfo.plist
 )

 set_target_properties(FFMPEG PROPERTIES
 MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/assets/MacOSXBundleInfo.plist
 )

elseif(WIN32)
 list(APPEND EXTRA_LIBS
 "-lglu32 -lopengl32"
 )
 set(CMAKE_EXE_LINKER_FLAGS "-std=gnu99 -static -static-libgcc -static-libstdc++ -mwindows")
else()
 list(APPEND EXTRA_LIBS
 "-lGL -lGLU -lX11"
 )
endif()


#target_link_libraries(Interview ${CORELIBS})

set( CMAKE_C_FLAGS "-lswresample")

list(APPEND EXTRA_LIBS
"-lGL -lGLU -lX11 -lz -lva -lswresample"
)

target_include_directories(ffmpeg_config INTERFACE
 ${AVCODEC_INCLUDE_DIR} 
 ${AVFORMAT_INCLUDE_DIR}
 ${AVUTIL_INCLUDE_DIR}
 ${AVDEVICE_INCLUDE_DIR} 
 ${OPENGL_INCLUDE_DIR}
 ${GLEW_INCLUDE_DIRS}
)

target_link_libraries(ffmpeg_config INTERFACE
 ${AVCODEC_LIBRARY} 
 ${AVFORMAT_LIBRARY} 
 ${AVUTIL_LIBRARY} 
 ${AVDEVICE_LIBRARY} 
 ${OPENGL_LIBRARY}
 ${GLEW_LIBRARIES}
)



Ubuntu 22.04, cmake 3.16.3, ffmpeg version git-2022-05-20-cb47f66