
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (43)
-
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela. -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
Contribute to translation
13 avril 2011You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
MediaSPIP is currently available in French and English (...)
Sur d’autres sites (2668)
-
How to stream webcam video over RTSP using ffmpeg on Windows 10 ? [closed]
15 mai 2024, par let me down slowlyI am trying to stream my laptop's webcam using RTSP protocol using
ffmpeg
. I am trying to simulate an actual IP Camera. I have already tried different tools already including usingVidGear
python package, andgstreamer
but could not get it working. Note : I am on Windows 10. I have tried this command :

ffmpeg -f dshow -s 320x240 -rtbufsize 2147.48M -r 30 -vcodec mjpeg -i video="HD Camera" -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mystream



It turns on the webcam with but prints these logs to the console :


ffmpeg version 7.0-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
 built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
 configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
 libavutil 59. 8.100 / 59. 8.100
 libavcodec 61. 3.100 / 61. 3.100
 libavformat 61. 1.100 / 61. 1.100
 libavdevice 61. 1.100 / 61. 1.100
 libavfilter 10. 1.100 / 10. 1.100
 libswscale 8. 1.100 / 8. 1.100
 libswresample 5. 1.100 / 5. 1.100
 libpostproc 58. 1.100 / 58. 1.100
[mjpeg @ 0000026201ae9fc0] unable to decode APP fields: Invalid data found when processing input
Input #0, dshow, from 'video=HD Camera':
 Duration: N/A, start: 1285415.793302, bitrate: N/A
 Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 320x240, 30 fps, 30 tbr, 10000k tbn
Stream mapping:
 Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
[mjpeg @ 0000026201afe9c0] unable to decode APP fields: Invalid data found when processing input
[swscaler @ 0000026201b5cc40] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000262068c57c0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000026201b5cc40] deprecated pixel format used, make sure you did set range correctly
 Last message repeated 1 times
[mjpeg @ 0000026201afe9c0] unable to decode APP fields: Invalid data found when processing input
 Last message repeated 8 times



I tried opening
rtsp://localhost:8554/mystream
but it showsVLC is unable to open the MRL 'rtsp://localhost:8554/mystream'. Check the log for details.


Killing the running process outputs these additional logs


[out#0/rtsp @ 0000026201aeaf80] Could not write header (incorrect codec parameters ?): Immediate exit requested
[vf#0:0 @ 0000026201af4100] Error sending frames to consumers: Immediate exit requested
[vf#0:0 @ 0000026201af4100] Task finished with error code: -1414092869 (Immediate exit requested)
[vf#0:0 @ 0000026201af4100] Terminating thread with return code -1414092869 (Immediate exit requested)
[out#0/rtsp @ 0000026201aeaf80] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A
Exiting normally, received signal 2.



Output of the command
ffmpeg -list_devices true -f dshow -i dummy
:

built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
 configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
 libavutil 59. 8.100 / 59. 8.100
 libavcodec 61. 3.100 / 61. 3.100
 libavformat 61. 1.100 / 61. 1.100
 libavdevice 61. 1.100 / 61. 1.100
 libavfilter 10. 1.100 / 10. 1.100
 libswscale 8. 1.100 / 8. 1.100
 libswresample 5. 1.100 / 5. 1.100
 libpostproc 58. 1.100 / 58. 1.100
[dshow @ 00000140f18d4200] "HD Camera" (video)
[dshow @ 00000140f18d4200] Alternative name "@device_pnp_\\?\usb#vid_05c8&pid_03ea&mi_00#6&d0a8c55&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 00000140f18d4200] "Microphone (Realtek(R) Audio)" (audio)
[dshow @ 00000140f18d4200] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{06840D8D-1151-4D9C-B865-2FE01BFB9FD2}"
[in#0 @ 00000140f18ba640] Error opening input: Immediate exit requested
Error opening input file dummy.



Output of the command
ffmpeg -f dshow -list_options true -i video="HD Camera"
:

built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
 configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
 libavutil 59. 8.100 / 59. 8.100
 libavcodec 61. 3.100 / 61. 3.100
 libavformat 61. 1.100 / 61. 1.100
 libavdevice 61. 1.100 / 61. 1.100
 libavfilter 10. 1.100 / 10. 1.100
 libswscale 8. 1.100 / 8. 1.100
 libswresample 5. 1.100 / 5. 1.100
 libpostproc 58. 1.100 / 58. 1.100
[dshow @ 000002670b4c12c0] DirectShow video device options (from video devices)
[dshow @ 000002670b4c12c0] Pin "Capture" (alternative pin name "Capture")
[dshow @ 000002670b4c12c0] vcodec=mjpeg min s=1280x720 fps=30 max s=1280x720 fps=30
[dshow @ 000002670b4c12c0] vcodec=mjpeg min s=640x480 fps=30 max s=640x480 fps=30
[dshow @ 000002670b4c12c0] vcodec=mjpeg min s=640x360 fps=30 max s=640x360 fps=30
[dshow @ 000002670b4c12c0] vcodec=mjpeg min s=352x288 fps=30 max s=352x288 fps=30
[dshow @ 000002670b4c12c0] vcodec=mjpeg min s=320x240 fps=30 max s=320x240 fps=30
[dshow @ 000002670b4c12c0] vcodec=mjpeg min s=176x144 fps=30 max s=176x144 fps=30
[dshow @ 000002670b4c12c0] pixel_format=yuyv422 min s=1280x720 fps=10 max s=1280x720 fps=10
[dshow @ 000002670b4c12c0] pixel_format=yuyv422 min s=640x480 fps=30 max s=640x480 fps=30
[dshow @ 000002670b4c12c0] pixel_format=yuyv422 min s=640x360 fps=30 max s=640x360 fps=30
[dshow @ 000002670b4c12c0] pixel_format=yuyv422 min s=352x288 fps=30 max s=352x288 fps=30
[dshow @ 000002670b4c12c0] pixel_format=yuyv422 min s=320x240 fps=30 max s=320x240 fps=30
[dshow @ 000002670b4c12c0] pixel_format=yuyv422 min s=176x144 fps=30 max s=176x144 fps=30
[in#0 @ 000002670b4aa200] Error opening input: Immediate exit requested
Error opening input file video=HD Camera.



Please help me solve the issue or suggest a better approach.


-
Can't set seeker in GSTREAMER cv2, python
29 avril, par Alperen ÖlçerI want to skip n seconds forward and backward in gstreamer cv2 capture for recorded videos. But when I use
cap_gstreamer.set(cv2.CAP_PROP_POS_FRAMES, fps*skip_second)
it resets seeker to beginning of video. How can I solve it ? I wrote an example, used recorded clock video.

import cv2

video_p = '/home/alperenlcr/Videos/clock.mp4'

cap_gstreamer = cv2.VideoCapture(video_p, cv2.CAP_GSTREAMER)
cap_ffmpeg = cv2.VideoCapture(video_p, cv2.CAP_FFMPEG)

fps = cap_gstreamer.get(cv2.CAP_PROP_FPS)
skip_second = 100

im1 = cv2.resize(cap_gstreamer.read()[1], (960, 540))
im1_ffmpeg = cv2.resize(cap_ffmpeg.read()[1], (960, 540))

cap_gstreamer.set(cv2.CAP_PROP_POS_FRAMES, fps*skip_second)
cap_ffmpeg.set(cv2.CAP_PROP_POS_FRAMES, fps*skip_second)

im2 = cv2.resize(cap_gstreamer.read()[1], (960, 540))
im2_ffmpeg = cv2.resize(cap_ffmpeg.read()[1], (960, 540))

merge_gstreamer = cv2.hconcat([im1, im2])
merge_ffmpeg = cv2.hconcat([im1_ffmpeg, im2_ffmpeg])

cv2.imshow(str(skip_second) + ' gstreamer', merge_gstreamer)
cv2.imshow(str(skip_second) + ' ffmpeg', merge_ffmpeg)
cv2.waitKey(0)
cv2.destroyAllWindows()

cap_gstreamer.release()
cap_ffmpeg.release()






My cv2 build is like :


>>> print(cv2.getBuildInformation())

General configuration for OpenCV 4.8.1 =====================================
 Version control: 4.8.1-dirty

 Extra modules:
 Location (extra): /home/alperenlcr/SourceInstalls/opencv_contrib/modules
 Version control (extra): 4.8.1

 Platform:
 Timestamp: 2024-12-02T13:44:58Z
 Host: Linux 6.8.0-49-generic x86_64
 CMake: 3.22.1
 CMake generator: Unix Makefiles
 CMake build tool: /usr/bin/gmake
 Configuration: RELEASE

 CPU/HW features:
 Baseline: SSE SSE2 SSE3
 requested: SSE3
 Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
 requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
 SSE4_1 (18 files): + SSSE3 SSE4_1
 SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
 FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
 AVX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
 AVX2 (37 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
 AVX512_SKX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

 C/C++:
 Built as dynamic libs?: NO
 C++ standard: 11
 C++ Compiler: /usr/bin/c++ (ver 10.5.0)
 C++ flags (Release): -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
 C++ flags (Debug): -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
 C Compiler: /usr/bin/cc
 C flags (Release): -fsigned-char -ffast-math -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
 C flags (Debug): -fsigned-char -ffast-math -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
 Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined 
 Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined 
 ccache: NO
 Precompiled headers: NO
 Extra dependencies: /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/x86_64-linux-gnu/libharfbuzz.so Iconv::Iconv m pthread cudart_static dl rt nppc nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/lib/x86_64-linux-gnu -L/usr/lib/cuda/lib64
 3rdparty dependencies: libprotobuf ade ittnotify libwebp libopenjp2 IlmImf quirc ippiw ippicv

 OpenCV modules:
 To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
 Disabled: cudacodec world
 Disabled by dependency: -
 Unavailable: alphamat cvv hdf java julia matlab ovis python2 sfm viz
 Applications: tests perf_tests examples apps
 Documentation: NO
 Non-free algorithms: NO

 GUI: GTK2
 QT: NO
 GTK+: YES (ver 2.24.33)
 GThread : YES (ver 2.72.4)
 GtkGlExt: NO
 OpenGL support: NO
 VTK support: NO

 Media I/O: 
 ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
 JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
 WEBP: build (ver encoder: 0x020f)
 PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
 TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.3.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
 avcodec: YES (58.134.100)
 avformat: YES (58.76.100)
 avutil: YES (56.70.100)
 swscale: YES (5.9.100)
 swresample: YES (3.9.100)
 GStreamer: YES (1.20.3)
 v4l/v4l2: YES (linux/videodev2.h)

 Parallel framework: TBB (ver 2021.5 interface 12050)

 Trace: YES (with Intel ITT)

 Other third-party libraries:
 Intel IPP: 2021.8 [2021.8.0]
 at: /home/alperenlcr/SourceInstalls/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
 Intel IPP IW: sources (2021.8.0)
 at: /home/alperenlcr/SourceInstalls/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
 VA: NO
 Lapack: NO
 Eigen: NO
 Custom HAL: NO
 Protobuf: build (3.19.1)
 Flatbuffers: builtin/3rdparty (23.5.9)

 NVIDIA CUDA: YES (ver 11.5, CUFFT CUBLAS NVCUVID NVCUVENC FAST_MATH)
 NVIDIA GPU arch: 86
 NVIDIA PTX archs:

 cuDNN: YES (ver 8.6.0)

 OpenCL: YES (no extra features)
 Include path: /home/alperenlcr/SourceInstalls/opencv/3rdparty/include/opencl/1.2
 Link libraries: Dynamic load

 ONNX: NO

 Python 3:
 Interpreter: /usr/bin/python3 (ver 3.10.12)
 Libraries: /usr/lib/x86_64-linux-gnu/libpython3.10.so (ver 3.10.12)
 numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.21.5)
 install path: lib/python3.10/dist-packages/cv2/python-3.10

 Python (for build): /usr/bin/python3

 Java: 
 ant: NO
 Java: NO
 JNI: NO
 Java wrappers: NO
 Java tests: NO

 Install to: /usr/local
-----------------------------------------------------------------




-
Error transcoding with FFmpeg : Error : Output format hls is not available
6 mai 2024, par asif mohmdI am using FFmpeg library to transcode a video file into multiple resolutions and create an HLS (HTTP Live Streaming) master playlist.


It takes a video file as input but its does give me the output with HLS playlist.I got a error called "Output format hls is not available". Only the Output directory is creating


I am using FFMpeg 7.0 full build version and also tried older versions and ffmpeg essentials and also tried chocolatey.


if i remove the implementation of HLS from this code.it will create 4 different resolution videos in my output.


Note:I just tried this same code on my friend MAC Book by only changing the setffmpegPath : "ffmpeg.setFfmpegPath("C :\ffmpeg\bin\ffmpeg.exe") ;" to his ffmpeg directory.
Its working perfectly in his mac book


import "dotenv/config";
import * as fs from "fs";
import * as path from "path";
import ffmpeg from "fluent-ffmpeg";
import crypto from "crypto";

ffmpeg.setFfmpegPath("C:\\ffmpeg\\bin\\ffmpeg.exe");

export const FFmpegTranscoder = async (file: any): Promise<any> => {
 try {
 console.log("Starting script");
 console.time("req_time");

 const randomName = (bytes = 32) =>
 crypto.randomBytes(bytes).toString("hex");
 const fileName = randomName();
 const directoryPath = path.join(__dirname, "..", "..", "input");
 const filePath = path.join(directoryPath, `${fileName}.mp4`);

 if (!fs.existsSync(directoryPath)) {
 fs.mkdirSync(directoryPath, { recursive: true });
 }

 const paths = await new Promise<any>((resolve, reject) => {
 fs.writeFile(filePath, file, async (err) => {
 if (err) {
 console.error("Error saving file:", err);
 throw err;
 }
 console.log("File saved successfully:", filePath);

 try {
 const outputDirectoryPath = await transcodeWithFFmpeg(
 fileName,
 filePath
 );
 resolve({ directoryPath, filePath, fileName, outputDirectoryPath });
 } catch (error) {
 console.error("Error transcoding with FFmpeg:", error);
 }
 });
 });
 return paths;
 } catch (e: any) {
 console.log(e);
 }
};

const transcodeWithFFmpeg = async (fileName: string, filePath: string) => {
 const directoryPath = path.join(
 __dirname,
 "..",
 "..",
 `output/hls/${fileName}`
 );

 if (!fs.existsSync(directoryPath)) {
 fs.mkdirSync(directoryPath, { recursive: true });
 }

 const resolutions = [
 {
 resolution: "256x144",
 videoBitrate: "200k",
 audioBitrate: "64k",
 },
 {
 resolution: "640x360",
 videoBitrate: "800k",
 audioBitrate: "128k",
 },
 {
 resolution: "1280x720",
 videoBitrate: "2500k",
 audioBitrate: "192k",
 },
 {
 resolution: "1920x1080",
 videoBitrate: "5000k",
 audioBitrate: "256k",
 },
 ];

 const variantPlaylists: { resolution: string; outputFileName: string }[] = [];

 for (const { resolution, videoBitrate, audioBitrate } of resolutions) {
 console.log(`HLS conversion starting for ${resolution}`);
 const outputFileName = `${fileName}_${resolution}.m3u8`;
 const segmentFileName = `${fileName}_${resolution}_%03d.ts`;

 await new Promise<void>((resolve, reject) => {
 ffmpeg(filePath)
 .outputOptions([
 `-c:v h264`,
 `-b:v ${videoBitrate}`,
 `-c:a aac`,
 `-b:a ${audioBitrate}`,
 `-vf scale=${resolution}`,
 `-f hls`,
 `-hls_time 10`,
 `-hls_list_size 0`,
 `-hls_segment_filename ${directoryPath}/${segmentFileName}`,
 ])
 .output(`${directoryPath}/${outputFileName}`)
 .on("end", () => resolve())
 .on("error", (err) => reject(err))
 .run();
 });
 const variantPlaylist = {
 resolution,
 outputFileName,
 };
 variantPlaylists.push(variantPlaylist);
 console.log(`HLS conversion done for ${resolution}`);
 }
 console.log(`HLS master m3u8 playlist generating`);

 let masterPlaylist = variantPlaylists
 .map((variantPlaylist) => {
 const { resolution, outputFileName } = variantPlaylist;
 const bandwidth =
 resolution === "256x144"
 ? 264000
 : resolution === "640x360"
 ? 1024000
 : resolution === "1280x720"
 ? 3072000
 : 5500000;
 ``;
 return `#EXT-X-STREAM-INF:BANDWIDTH=${bandwidth},RESOLUTION=${resolution}\n${outputFileName}`;
 })
 .join("\n");
 masterPlaylist = `#EXTM3U\n` + masterPlaylist;

 const masterPlaylistFileName = `${fileName}_master.m3u8`;

 const masterPlaylistPath = `${directoryPath}/${masterPlaylistFileName}`;
 fs.writeFileSync(masterPlaylistPath, masterPlaylist);
 console.log(`HLS master m3u8 playlist generated`);
 return directoryPath;
};
</void></any></any>


My console.log is :


Starting script
 HLS conversion starting for 256x144
 Error transcoding with FFmpeg: Error: Output format hls is not available
 at C:\Users\asifa\Desktop\Genius Grid\Transcode-service\node_modules\fluent-ffmpeg\lib\capabilities.js:589:21
 at nextTask (C:\Users\asifa\Desktop\Genius Grid\Transcode-service\node_modules\async\dist\async.js:5791:13)
 at next (C:\Users\asifa\Desktop\Genius Grid\Transcode-service\node_modules\async\dist\async.js:5799:13)
 at C:\Users\asifa\Desktop\Genius Grid\Transcode-service\node_modules\async\dist\async.js:329:20
 at C:\Users\asifa\Desktop\Genius Grid\Transcode-service\node_modules\fluent-ffmpeg\lib\capabilities.js:549:7
 at handleExit (C:\Users\asifa\Desktop\Genius Grid\Transcode-service\node_modules\fluent-ffmpeg\lib\processor.js:170:11)
 at ChildProcess.<anonymous> (C:\Users\asifa\Desktop\Genius Grid\Transcode-service\node_modules\fluent-ffmpeg\lib\processor.js:184:11)
 at ChildProcess.emit (node:events:518:28)
 at ChildProcess.emit (node:domain:488:12)
 at Process.ChildProcess._handle.onexit (node:internal/child_process:294:12) 
</anonymous>


I am using Windows 11 and FFMpeg version 7.0. I repeatedly checked, using CMD commands, that my FFMpeg was installed correctly and confirmed the environment variables path, experimented with various FFMpeg versions, and tried with FFMpeg full build Chocolatey package.


In Command Line its working perfectly :


PS C:\Users\asifa\Desktop\test fmmpeg> ffmpeg -hide_banner -y -i .\SampleVideo_1280x720_30mb.mp4 -vf scale=w=640:h=360:force_original_aspect_ratio=decrease -c:a aac -b:v 800k -c:v h264 -b:a 128k -f hls -hls_time 14 -hls_list_size 0 -hls_segment_filename beach/480p_%03d.ts beach/480p.m3u8
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '.\SampleVideo_1280x720_30mb.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 creation_time : 1970-01-01T00:00:00.000000Z
 encoder : Lavf53.24.2
 Duration: 00:02:50.86, start: 0.000000, bitrate: 1474 kb/s
 Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 1086 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
 Metadata:
 creation_time : 1970-01-01T00:00:00.000000Z
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
 Metadata:
 creation_time : 1970-01-01T00:00:00.000000Z
 handler_name : SoundHandler
 vendor_id : [0][0][0][0]
Stream mapping:
 Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
 Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 000001ef1288ec00] using SAR=1/1
[libx264 @ 000001ef1288ec00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001ef1288ec00] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 000001ef1288ec00] 264 - core 164 r3190 7ed753b - H.264/MPEG-4 AVC codec - Copyleft 2003-2024 - 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=11 lookahead_threads=1 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=abr mbtree=1 bitrate=800 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, hls, to 'beach/480p.m3u8':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf61.1.100
 Stream #0:0(und): Video: h264, yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 800 kb/s, 25 fps, 90k tbn (default)
 Metadata:
 creation_time : 1970-01-01T00:00:00.000000Z
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 encoder : Lavc61.3.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/800000 buffer size: 0 vbv_delay: N/A
 Stream #0:1(und): Audio: aac (LC), 48000 Hz, 5.1, fltp, 128 kb/s (default)
 Metadata:
 creation_time : 1970-01-01T00:00:00.000000Z
 handler_name : SoundHandler
 vendor_id : [0][0][0][0]
 encoder : Lavc61.3.100 aac
[hls @ 000001ef12482040] Opening 'beach/480p_000.ts' for writing speed=15.5x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_001.ts' for writing speed=17.9x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_002.ts' for writing speed=17.3x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_003.ts' for writing speed=19.4x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_004.ts' for writing speed=19.3x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_005.ts' for writing speed=19.2x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_006.ts' for writing
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_007.ts' for writing speed=19.4x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_008.ts' for writing speed=19.5x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_009.ts' for writing speed=19.5x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_010.ts' for writing speed=19.4x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[hls @ 000001ef12482040] Opening 'beach/480p_011.ts' for writing/A =19.4x
[hls @ 000001ef12482040] Opening 'beach/480p.m3u8.tmp' for writing
[out#0/hls @ 000001ef11d4e880] video:17094KiB audio:2680KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame= 4271 fps=485 q=-1.0 Lsize=N/A time=00:02:50.76 bitrate=N/A speed=19.4x
[libx264 @ 000001ef1288ec00] frame I:45 Avg QP:10.29 size: 60418
[libx264 @ 000001ef1288ec00] frame P:1914 Avg QP:14.53 size: 5582
[libx264 @ 000001ef1288ec00] frame B:2312 Avg QP:20.63 size: 1774
[libx264 @ 000001ef1288ec00] consecutive B-frames: 22.9% 11.9% 8.6% 56.6%
[libx264 @ 000001ef1288ec00] mb I I16..4: 15.6% 32.1% 52.2%
[libx264 @ 000001ef1288ec00] mb P I16..4: 0.3% 3.4% 1.2% P16..4: 20.3% 10.0% 13.1% 0.0% 0.0% skip:51.8%
[libx264 @ 000001ef1288ec00] mb B I16..4: 0.1% 0.9% 0.4% B16..8: 17.2% 5.6% 2.8% direct: 2.0% skip:71.0% L0:41.5% L1:44.1% BI:14.4%
[libx264 @ 000001ef1288ec00] final ratefactor: 16.13
[libx264 @ 000001ef1288ec00] 8x8 transform intra:58.4% inter:51.7%
[libx264 @ 000001ef1288ec00] coded y,uvDC,uvAC intra: 86.7% 94.3% 78.8% inter: 12.6% 15.0% 4.5%
[libx264 @ 000001ef1288ec00] i16 v,h,dc,p: 17% 42% 14% 28%
[libx264 @ 000001ef1288ec00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 19% 11% 6% 7% 8% 8% 9% 9%
[libx264 @ 000001ef1288ec00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 18% 12% 6% 9% 9% 8% 8% 7%
[libx264 @ 000001ef1288ec00] i8c dc,h,v,p: 44% 24% 20% 12%
[libx264 @ 000001ef1288ec00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001ef1288ec00] ref P L0: 78.3% 9.7% 8.8% 3.2%
[libx264 @ 000001ef1288ec00] ref B L0: 92.5% 6.0% 1.5%
[libx264 @ 000001ef1288ec00] ref B L1: 97.1% 2.9%
[libx264 @ 000001ef1288ec00] kb/s:819.63
[aac @ 000001ef128f7c80] Qavg: 452.137



When I use the
.on('start', (cmdline) => console.log(cmdline))}
code with the-f hls
command, the error "Output format hls is not available" appears, as previously mentioned. But my Console.log looks like this if I run my code without using-f hls
command :

Without -f hls command


await new Promise<void>((resolve, reject) => {
 ffmpeg(filePath)
 .outputOptions([
 `-c:v h264`,
 `-b:v ${videoBitrate}`,
 `-c:a aac`,
 `-b:a ${audioBitrate}`,
 `-vf scale=${resolution}`,
 
 `-hls_time 10`,
 `-hls_list_size 0`,
 `-hls_segment_filename ${directoryPath}/${segmentFileName}`,
 ])
 .output(`${directoryPath}/${outputFileName}`)
 .on('start', (cmdline) => console.log(cmdline)) 
 .on("end", () => resolve())
 .on("error", (err) => reject(err))
 .run();
});
</void>


Console.log is :


`Starting script
File saved successfully: C:\Users\asifa\Desktop\Genius Grid\Transcode-service\input\c9fcf43726e617a295b203d5acb7b81658b5f05f80eafc74cee21b053422fef1.mp4
HLS conversion starting for 256x144
ffmpeg -i C:\Users\asifa\Desktop\Genius Grid\Transcode-service\input\c9fcf43726e617a295b203d5acb7b81658b5f05f80eafc74cee21b053422fef1.mp4 -y -c:v h264 -b:v 200k -c:a aac -b:a 64k -vf scale=256x144 -hls_time 10 -hls_list_size 0 -hls_segment_filename C:\Users\asifa\Desktop\Genius Grid\Transcode-service\output\hls\c9fcf43726e617a295b203d5acb7b81658b5f05f80eafc74cee21b053422fef1/c9fcf43726e617a295b203d5acb7b81658b5f05f80eafc74cee21b053422fef1_256x144_%03d.ts C:\Users\asifa\Desktop\Genius Grid\Transcode-service\output\hls\c9fcf43726e617a295b203d5acb7b81658b5f05f80eafc74cee21b053422fef1/c9fcf43726e617a295b203d5acb7b81658b5f05f80eafc74cee21b053422fef1_256x144.m3u8
Error transcoding with FFmpeg: Error: ffmpeg exited with code 2880417800: Unrecognized option 'hls_segment_filename C:\Users\asifa\Desktop\Genius Grid\Transcode-service\output\hls\c9fcf43726e617a295b203d5acb7b81658b5f05f80eafc74cee21b053422fef1/c9fcf43726e617a295b203d5acb7b81658b5f05f80eafc74cee21b053422fef1_256x144_%03d.ts'.
Error splitting the argument list: Option not found`