Recherche avancée
Médias (91)
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Core Media Video
4 avril 2013, par
Mis à jour : Juin 2013
Langue : français
Type : Video
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Sur d’autres sites (333)
-
Receive RTMP stream with OpenCV (python)
12 février, par OvernoutI'm trying to process an RTMP stream in Python, using OpenCV2 but I'm not able to get OpenCV to capture it.


I can run FFmpeg/FFplay from the command line and receive the stream successfully.
What could cause OpenCV to fail opening the stream in listening mode ?


Here is my code :


import cv2

cap = cv2.VideoCapture("rtmp://0.0.0.0/live/stream", cv2.CAP_FFMPEG)

if not cap.isOpened():
 print("Cannot open video source")
 exit()



And the output :


[tcp @ 00000192c490d640] Connection to tcp://0.0.0.0:1935 failed: Error number -138 occurred
[rtmp @ 00000192c490d580] Cannot open connection tcp://0.0.0.0:1935 Cannot open video source



Here is the output of cv2.getBuildInformation()


General configuration for OpenCV 4.9.0 =====================================
 Version control: 4.9.0

 Platform:
 Timestamp: 2023-12-31T11:21:12Z
 Host: Windows 10.0.17763 AMD64
 CMake: 3.24.2
 CMake generator: Visual Studio 14 2015
 CMake build tool: MSBuild.exe
 MSVC: 1900
 Configuration: Debug Release

 CPU/HW features:
 Baseline: SSE SSE2 SSE3
 requested: SSE3
 Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2
 requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
 SSE4_1 (16 files): + SSSE3 SSE4_1
 SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
 FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
 AVX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
 AVX2 (36 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2

 C/C++:
 Built as dynamic libs?: NO
 C++ standard: 11
 C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe (ver 19.0.24247.2)
 C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /O2 /Ob2 /DNDEBUG 
 C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /Zi /Ob0 /Od /RTC1 
 C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
 C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /MP /O2 /Ob2 /DNDEBUG 
 C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /MP /Zi /Ob0 /Od /RTC1 
 Linker flags (Release): /machine:x64 /NODEFAULTLIB:atlthunk.lib /INCREMENTAL:NO /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:libcpmtd.lib /NODEFAULTLIB:msvcrtd.lib
 Linker flags (Debug): /machine:x64 /NODEFAULTLIB:atlthunk.lib /debug /INCREMENTAL /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:msvcrt.lib
 ccache: NO
 Precompiled headers: YES
 Extra dependencies: wsock32 comctl32 gdi32 ole32 setupapi ws2_32
 3rdparty dependencies: libprotobuf ade ittnotify libjpeg-turbo libwebp libpng libtiff libopenjp2 IlmImf zlib ippiw ippicv

 OpenCV modules:
 To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio
 Disabled: java world
 Disabled by dependency: -
 Unavailable: python2 ts
 Applications: -
 Documentation: NO
 Non-free algorithms: NO

 Windows RT support: NO

 GUI: WIN32UI
 Win32 UI: YES
 VTK support: NO

 Media I/O: 
 ZLib: build (ver 1.3)
 JPEG: build-libjpeg-turbo (ver 2.1.3-62)
 SIMD Support Request: YES
 SIMD Support: NO
 WEBP: build (ver encoder: 0x020f)
 PNG: build (ver 1.6.37)
 TIFF: build (ver 42 - 4.2.0)
 JPEG 2000: build (ver 2.5.0)
 OpenEXR: build (ver 2.3.0)
 HDR: YES
 SUNRASTER: YES
 PXM: YES
 PFM: YES

 Video I/O:
 DC1394: NO
 FFMPEG: YES (prebuilt binaries)
 avcodec: YES (58.134.100)
 avformat: YES (58.76.100)
 avutil: YES (56.70.100)
 swscale: YES (5.9.100)
 avresample: YES (4.0.0)
 GStreamer: NO
 DirectShow: YES
 Media Foundation: YES
 DXVA: YES

 Parallel framework: Concurrency

 Trace: YES (with Intel ITT)

 Other third-party libraries:
 Intel IPP: 2021.11.0 [2021.11.0]
 at: D:/a/opencv-python/opencv-python/_skbuild/win-amd64-3.7/cmake-build/3rdparty/ippicv/ippicv_win/icv
 Intel IPP IW: sources (2021.11.0)
 at: D:/a/opencv-python/opencv-python/_skbuild/win-amd64-3.7/cmake-build/3rdparty/ippicv/ippicv_win/iw
 Lapack: NO
 Eigen: NO
 Custom HAL: NO
 Protobuf: build (3.19.1)
 Flatbuffers: builtin/3rdparty (23.5.9)

 OpenCL: YES (NVD3D11)
 Include path: D:/a/opencv-python/opencv-python/opencv/3rdparty/include/opencl/1.2
 Link libraries: Dynamic load

 Python 3:
 Interpreter: C:/hostedtoolcache/windows/Python/3.7.9/x64/python.exe (ver 3.7.9)
 Libraries: C:/hostedtoolcache/windows/Python/3.7.9/x64/libs/python37.lib (ver 3.7.9)
 numpy: C:/hostedtoolcache/windows/Python/3.7.9/x64/lib/site-packages/numpy/core/include (ver 1.17.0)
 install path: python/cv2/python-3

 Python (for build): C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe

 Java: 
 ant: NO
 Java: YES (ver 1.8.0.392)
 JNI: C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk/8.0.392-8/x64/include C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk/8.0.392-8/x64/include/win32 C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk/8.0.392-8/x64/include
 Java wrappers: NO
 Java tests: NO

 Install to: D:/a/opencv-python/opencv-python/_skbuild/win-amd64-3.7/cmake-install
-----------------------------------------------------------------



-
AWS Lambda failed to resolve hostname in child_process spawn
28 mars, par warlyi'm trying to get ffmpeg working in AWS Lambda reading from and writing to S3. I crawled through dozens of aws documentations, stackoverflow questions and blog posts. All do it slightly different, but in the end none of them worked for me. So I hope to find help here :)
I sticked to the tutorial from InPlainEnglish : https://plainenglish.io/community/automated-video-processing-with-aws-lambda-and-ffmpeg-2834b7


The ffprobe command does work, so ffmpeg is callable. But when calling ffmpeg within a child_process.spawn command i get the error
Failed to resolve hostname my-bucket.s3.eu-central-1.amazonaws.com: System error


export const handler = async (event) => {
 const s3 = new S3Client({});
 const bucket = event.Records[0].s3.bucket.name;
 const sourceKey = event.Records[0].s3.object.key;
 const sourceURL = await getSignedUrl(s3, new GetObjectCommand({
 Bucket: bucket,
 Key: sourceKey,
 }), {
 expiresIn: 900,
 });

 const tmpFilePath = 'tmp/video.mp4';
 const { convertOut } = await commander(`/opt/ffmpeg -i "${sourceURL}" -vf scale=1080:-2,format=yuv420p ${tmpFilePath}`);

 return {
 statusCode: 200,
 body: {
 result: JSON.stringify(convertOut),
 },
 };
};



the signed url is fine. I've tested it with vanilla js
await fetch(sourceURL)
and it returned the file. The problem is that for some reason the child_process has no internet access.

if anyone is able to point me in the right direction i would appreciate it :D


Full error message :


{
 "errorType": "Error",
 "errorMessage": "Command failed: /opt/ffmpeg -i \"https://my-bucket.s3.eu-central-1.amazonaws.com/original/Testvideo.MOV?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential={redacted}&X-Amz-Date=20240209T212255Z&X-Amz-Expires=900&X-Amz-Security-Token={redacted}&X-Amz-Signature={redacted}&X-Amz-SignedHeaders=host&x-id=GetObject\" -vf scale=1080:-2,crop=1080:1350,format=yuv420p tmp/video.mp4\nffmpeg version 6.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2023 the FFmpeg developers\n built with gcc 8 (Debian 8.3.0-6)\n configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzimg\n libavutil 58. 29.100 / 58. 29.100\n libavcodec 60. 31.102 / 60. 31.102\n libavformat 60. 16.100 / 60. 16.100\n libavdevice 60. 3.100 / 60. 3.100\n libavfilter 9. 12.100 / 9. 12.100\n libswscale 7. 5.100 / 7. 5.100\n libswresample 4. 12.100 / 4. 12.100\n libpostproc 57. 3.100 / 57. 3.100\n[tcp @ 0x141950d0] Failed to resolve hostname my-bucket.s3.eu-central-1.amazonaws.com: System error\n[in#0 @ 0x14190900] Error opening input: Input/output error\nError opening input file https://my-bucket.s3.eu-central-1.amazonaws.com/original/Testvideo.MOV?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential={redacted}&X-Amz-Date=20240209T212255Z&X-Amz-Expires=900&X-Amz-Security-Token={redacted}&X-Amz-Signature={redacted}&X-Amz-SignedHeaders=host&x-id=GetObject.\nError opening input files: Input/output error\n",
 "trace": [
 "Error: Command failed: /opt/ffmpeg -i \"https://my-bucket.s3.eu-central-1.amazonaws.com/original/Testvideo.MOV?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential={redacted}&X-Amz-Date=20240209T212255Z&X-Amz-Expires=900&X-Amz-Security-Token={redacted}&X-Amz-Signature={redacted}&X-Amz-SignedHeaders=host&x-id=GetObject\" -vf scale=1080:-2,crop=1080:1350,format=yuv420p tmp/video.mp4",
 "ffmpeg version 6.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2023 the FFmpeg developers",
 " built with gcc 8 (Debian 8.3.0-6)",
 " configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzimg",
 " libavutil 58. 29.100 / 58. 29.100",
 " libavcodec 60. 31.102 / 60. 31.102",
 " libavformat 60. 16.100 / 60. 16.100",
 " libavdevice 60. 3.100 / 60. 3.100",
 " libavfilter 9. 12.100 / 9. 12.100",
 " libswscale 7. 5.100 / 7. 5.100",
 " libswresample 4. 12.100 / 4. 12.100",
 " libpostproc 57. 3.100 / 57. 3.100",
 "[tcp @ 0x141950d0] Failed to resolve hostname my-bucket.s3.eu-central-1.amazonaws.com: System error",
 "[in#0 @ 0x14190900] Error opening input: Input/output error",
 "Error opening input file https://my-bucket.s3.eu-central-1.amazonaws.com/original/Testvideo.MOV?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential={redacted}&X-Amz-Date=20240209T212255Z&X-Amz-Expires=900&X-Amz-Security-Token={redacted}&X-Amz-Signature={redacted}&X-Amz-SignedHeaders=host&x-id=GetObject.",
 "Error opening input files: Input/output error",
 "",
 " at ChildProcess.exithandler (node:child_process:422:12)",
 " at ChildProcess.emit (node:events:518:28)",
 " at maybeClose (node:internal/child_process:1105:16)",
 " at ChildProcess._handle.onexit (node:internal/child_process:305:5)"
 ]
}
enter code here



Update : Turns out it is not S3 or internet, but the child_process which does not seem to have internet access. I've update my description above.


-
AWS Lambda failed to resolve hostname on S3 signed url
9 février, par warlyi'm trying to get ffmpeg working in AWS Lambda reading from and writing to S3. I crawled through dozens of aws documentations, stackoverflow questions and blog posts. All do it slightly different, but in the end none of them worked for me. So I hope to find help here :)
I sticked to the tutorial from InPlainEnglish : https://plainenglish.io/community/automated-video-processing-with-aws-lambda-and-ffmpeg-2834b7


The ffprobe command does work, so ffmpeg is callable. But when calling ffmpeg with an S3 signed url i get the error
Failed to resolve hostname my-bucket.s3.eu-central-1.amazonaws.com: System error


export const handler = async (event) => {
 const s3 = new S3Client({});
 const bucket = event.Records[0].s3.bucket.name;
 const sourceKey = event.Records[0].s3.object.key;
 const sourceURL = await getSignedUrl(s3, new GetObjectCommand({
 Bucket: bucket,
 Key: sourceKey,
 }), {
 expiresIn: 900,
 });

 const tmpFilePath = 'tmp/video.mp4';
 const { convertOut } = await commander(`/opt/ffmpeg -i "${sourceURL}" -vf scale=1080:-2,format=yuv420p ${tmpFilePath}`);

 return {
 statusCode: 200,
 body: {
 result: JSON.stringify(convertOut),
 },
 };
};



if anyone is able to point me in the right direction i would appreciate it :D


Full error message :


{
 "errorType": "Error",
 "errorMessage": "Command failed: /opt/ffmpeg -i \"https://my-bucket.s3.eu-central-1.amazonaws.com/original/Testvideo.MOV?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential={redacted}&X-Amz-Date=20240209T212255Z&X-Amz-Expires=900&X-Amz-Security-Token={redacted}&X-Amz-Signature={redacted}&X-Amz-SignedHeaders=host&x-id=GetObject\" -vf scale=1080:-2,crop=1080:1350,format=yuv420p tmp/video.mp4\nffmpeg version 6.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2023 the FFmpeg developers\n built with gcc 8 (Debian 8.3.0-6)\n configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzimg\n libavutil 58. 29.100 / 58. 29.100\n libavcodec 60. 31.102 / 60. 31.102\n libavformat 60. 16.100 / 60. 16.100\n libavdevice 60. 3.100 / 60. 3.100\n libavfilter 9. 12.100 / 9. 12.100\n libswscale 7. 5.100 / 7. 5.100\n libswresample 4. 12.100 / 4. 12.100\n libpostproc 57. 3.100 / 57. 3.100\n[tcp @ 0x141950d0] Failed to resolve hostname my-bucket.s3.eu-central-1.amazonaws.com: System error\n[in#0 @ 0x14190900] Error opening input: Input/output error\nError opening input file https://my-bucket.s3.eu-central-1.amazonaws.com/original/Testvideo.MOV?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential={redacted}&X-Amz-Date=20240209T212255Z&X-Amz-Expires=900&X-Amz-Security-Token={redacted}&X-Amz-Signature={redacted}&X-Amz-SignedHeaders=host&x-id=GetObject.\nError opening input files: Input/output error\n",
 "trace": [
 "Error: Command failed: /opt/ffmpeg -i \"https://my-bucket.s3.eu-central-1.amazonaws.com/original/Testvideo.MOV?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential={redacted}&X-Amz-Date=20240209T212255Z&X-Amz-Expires=900&X-Amz-Security-Token={redacted}&X-Amz-Signature={redacted}&X-Amz-SignedHeaders=host&x-id=GetObject\" -vf scale=1080:-2,crop=1080:1350,format=yuv420p tmp/video.mp4",
 "ffmpeg version 6.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2023 the FFmpeg developers",
 " built with gcc 8 (Debian 8.3.0-6)",
 " configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzimg",
 " libavutil 58. 29.100 / 58. 29.100",
 " libavcodec 60. 31.102 / 60. 31.102",
 " libavformat 60. 16.100 / 60. 16.100",
 " libavdevice 60. 3.100 / 60. 3.100",
 " libavfilter 9. 12.100 / 9. 12.100",
 " libswscale 7. 5.100 / 7. 5.100",
 " libswresample 4. 12.100 / 4. 12.100",
 " libpostproc 57. 3.100 / 57. 3.100",
 "[tcp @ 0x141950d0] Failed to resolve hostname my-bucket.s3.eu-central-1.amazonaws.com: System error",
 "[in#0 @ 0x14190900] Error opening input: Input/output error",
 "Error opening input file https://my-bucket.s3.eu-central-1.amazonaws.com/original/Testvideo.MOV?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential={redacted}&X-Amz-Date=20240209T212255Z&X-Amz-Expires=900&X-Amz-Security-Token={redacted}&X-Amz-Signature={redacted}&X-Amz-SignedHeaders=host&x-id=GetObject.",
 "Error opening input files: Input/output error",
 "",
 " at ChildProcess.exithandler (node:child_process:422:12)",
 " at ChildProcess.emit (node:events:518:28)",
 " at maybeClose (node:internal/child_process:1105:16)",
 " at ChildProcess._handle.onexit (node:internal/child_process:305:5)"
 ]
}
enter code here