
Recherche avancée
Autres articles (12)
-
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Qualité du média après traitement
21 juin 2013, parLe bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...) -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.
Sur d’autres sites (4219)
-
ffmpeg drawtext Arabic fonts doesn't render correctly [closed]
11 février 2024, par Mahmoud Abdellatiefwhat i'm trying to achieve :
loop an image into a video and overlay Arabic Text from the Qur'an on it including the text diacritical mark, using a custom font.


example of the text to be rendered :


بِسْمِ ٱللَّهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ



the font used :
https://fonts.qurancomplex.gov.sa/wp02/wp-content/uploads/2024/01/UthmanicHafs_v22.zip


font's unicode module :


Unicode Module 
 
The Research and Development Unit in the Computer Department at King Fahd Glorious Qur’an Printing Complex relied on the unicode system unicode to create (Hafs) font in the Uthmanic Script, because this system is followed globally among computer and systems manufacturing companies in the world.

Unicode organization is a global code group that is used to define all codes and letters used in most of the world's languages and gathered in one code to facilitate the presentation and delivery on information despite of the language used. This global coding uses 1 to 4 bytes (byte = 8 bits) to encode letters, and so far only a third of the number available in Unicode organization to encode the letters of these languages.

Taking into account Hafs font with the Uthmanic Script, which was built entirely on the unicode system. We can explore the basic letters that were formed according to the following figure:

Whereas the font was developed starting from code (0600 ) to code (066FF ) Taking into account there are several encoded letters that haven't been used at all so it was replaces with the code []. The displayed copy above is the one that is been developed from the basic Arabic coding (0600-06FF) which was updated by Unicode organization in 2009.



expected result :
exported video with correctly rendered text using the given font.


actual result :
the text rendered contains only the diacritical marks ( which are the accents on top of the letters ) without the actual letters.



what i tried :
this is my test command which exports just an image for faster results :


Ffmpeg -loop 1 -i "image-2.jpg" -vf "drawtext=text='بِسْمِ ٱللَّهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ':fontsize=124:fontcolor=white:fontfile='UthmanicHafsV22.ttf':x=(w-text_w)/2:y=(h-text_h)/2" -frames:v 1 "output.png"



- 

- tried adding ft_load_flags , almost tried all of them
- tried text_shaping=1 , with no success
- tried textfile instead of text
- tried changing the font, any font i try with it always have different problems, either some squares instead of the diacritical mark










p.s im having same results on both latest ffmpeg compiled by myself on macos terminal with all required libraries enabled , and also on flutter ffmpeg kit full gpl


-
How can I publish an RTSP stream to a MediaMTX instance with TLS encryption configured ? [closed]
15 février 2024, par cmdI have an instance of (MediaMTX) running on my laptop. I have an Amcrest IP camera. I can publish the camera's RTSP stream to the server so that the stream can be accessed from the MediaMTX instance.


However, I want to encrypt the stream. On the Github page for MediaMTX, they detail how TLS encryption can be enabled for incoming and outgoing RTSP streams by generating a server.key and server.crt and editing lines in the .yml configuration file. Streams can then be published and read with RTSPS and port 8322.


I have followed these steps, and set up the following path for my IP camera in the .yml :


###############################################
# Path settings

# Settings in "paths" are applied to specific paths, and the map key
# is the name of the path.
# Any setting in "pathDefaults" can be overridden here.
# It's possible to use regular expressions by using a tilde as prefix,
# for example "~^(test1|test2)$" will match both "test1" and "test2",
# for example "~^prefix" will match all paths that start with "prefix".
paths:

 cam1:
 source: rtsp://user:password@192.168.68.142:554
 runOnInit: ffmpeg -i rtsp://user:password@192.168.68.142:554 -c:v copy -c:a copy -f rtsp rtsps://localhost:8322/stream/cam1



But I am getting the following output from my MediaMTX instance when it runs :


2024/02/15 18:20:59 INF [path cam1] [RTSP source] ready: 2 tracks (H264, MPEG-4 Audio)
Input #0, rtsp, from 'rtsp://user:password@192.168.68.142:554':
 Metadata:
 title : Media Server
 Duration: N/A, start: 0.030000, bitrate: N/A
 Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 100 tbr, 90k tbn
 Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Stream mapping:
 Stream #0:0 -> #0:0 (copy)
 Stream #0:1 -> #0:1 (copy)
2024/02/15 18:21:00 INF [RTSPS] [conn [::1]:60147] opened
2024/02/15 18:21:00 INF [RTSPS] [session 07a8f23e] created by [::1]:60147
2024/02/15 18:21:00 INF [RTSPS] [conn [::1]:60147] closed: path 'stream/cam1' is not configured
2024/02/15 18:21:00 INF [RTSPS] [session 07a8f23e] destroyed: not in use
[out#0/rtsp @ 00000225c75fe9c0] Could not write header (incorrect codec parameters ?): Server returned 400 Bad Request
Conversion failed!
2024/02/15 18:21:00 INF [path cam1] runOnInit command exited: command exited with code 3486501640
2024/02/15 18:21:29 WAR [path cam1] [RTSP source] 10 RTP packets lost
2024/02/15 18:21:33 WAR [path cam1] [RTSP source] 2 RTP packets lost
2024/02/15 18:21:39 WAR [path cam1] [RTSP source] 11 RTP packets lost



I have no errors and was able to publish the stream with the same path configuration (using rtsp ://, not rtsps ://) when using no encryption. What possible solutions can I try ?


-
How to extract the first frame from a video ?
10 août 2024, par AndrewI am trying to extract the first frame from a video to save it as a preview.


Here's an almost working solution using ffmpeg :


func extractFirstFrame(videoBytes []byte) ([]byte, error) {
 input := bytes.NewReader(videoBytes)

 var output bytes.Buffer

 err := ffmpeg.Input("pipe:0").
 Filter("select", ffmpeg.Args{"gte(n,1)"}).
 Output(
 "pipe:1",
 ffmpeg.KwArgs{
 "vframes": 1,
 "format": "image2",
 "vcodec": "mjpeg",
 }).
 WithInput(input).
 WithOutput(&output).
 Run()

 if err != nil {
 return nil, fmt.Errorf("error extracting frame: %v", err)
 }

 return output.Bytes(), nil
}



The problem with this is that it can only process horizontal videos. For some reason it will throw a
0xbebbb1b7
error for a vertical videos. I don't understand why is that, probably because this is my very first time with ffmpeg.

Also, I am concerned if this solution is optimal. My assumption is that the whole video will be loaded into the memory first, which is kinda bad and I would like to avoid that


I use
https://github.com/u2takey/ffmpeg-go
, but errors are the same even if I run it usingexec
:

cmd := exec.Command(
 "ffmpeg",
 "-i", "pipe:0",
 "-vf", "select=eq(n\\,0)",
 "-q:v", "3",
 "-f", "image2",
 "pipe:1",
 )



Interestingly enough, I noticed that running command in the terminal will work as expected with any type of video
ffmpeg -i .\video_2024-08-10_00-03-00.mp4 -vf "select=eq(n\,0)" -q:v 3 output_image.jpg
, so the problem may be on how I send those videos to my server. I useFiber and send videos asmultipart/form-data
and then read it like this :

form_data, err := c.FormFile("image")
 file, err := form_data.Open()
 bytes, err := io.ReadAll(file)
 ....
 preview, err := extractFirstFrame(bytes)




I also managed to find logs for the failed attempt :



ffmpeg version 7.0.2-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
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a562ff0e80] stream 0, offset 0x30: partial file
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a562ff0e80] Could not find codec parameters for stream 1 (Video: h264 (avc1 / 0x31637661), none, 720x1280, 3093 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 creation_time : 2024-08-09T20:00:29.000000Z
 Duration: 00:00:06.80, start: 0.000000, bitrate: N/A
 Stream #0:0[0x1](eng): Audio: aac (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 74 kb/s (default)
 Metadata:
 creation_time : 2024-08-09T20:00:23.000000Z
 handler_name : SoundHandle
 vendor_id : [0][0][0][0]
 Stream #0:1[0x2](eng): Video: h264 (avc1 / 0x31637661), none, 720x1280, 3093 kb/s, 30 fps, 30 tbr, 90k tbn (default)
 Metadata:
 creation_time : 2024-08-09T20:00:23.000000Z
 handler_name : VideoHandle
 vendor_id : [0][0][0][0]
Stream mapping:
 Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native))
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a562ff0e80] stream 1, offset 0x5d: partial file
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 000002a562fda2c0] Error during demuxing: Invalid data found when processing input
Cannot determine format of input 0:1 after EOF
[vf#0:0 @ 000002a5636c0ec0] Task finished with error code: -1094995529 (Invalid data found when processing input)
[vf#0:0 @ 000002a5636c0ec0] Terminating thread with return code -1094995529 (Invalid data found when processing input)
[vost#0:0/mjpeg @ 000002a5636c0400] Could not open encoder before EOF
[vost#0:0/mjpeg @ 000002a5636c0400] Task finished with error code: -22 (Invalid argument)
[vost#0:0/mjpeg @ 000002a5636c0400] Terminating thread with return code -22 (Invalid argument)
[out#0/image2 @ 000002a562ff5640] 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
Conversion failed!



Logs for the same video, but ran via terminal :


ffmpeg version 7.0.2-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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '.\video_2024-08-10_00-03-00.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 creation_time : 2024-08-09T20:00:29.000000Z
 Duration: 00:00:06.80, start: 0.000000, bitrate: 3175 kb/s
 Stream #0:0[0x1](eng): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 74 kb/s (default)
 Metadata:
 creation_time : 2024-08-09T20:00:23.000000Z
 handler_name : SoundHandle
 vendor_id : [0][0][0][0]
 Stream #0:1[0x2](eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 720x1280, 3093 kb/s, 30 fps, 30 tbr, 90k tbn (default)
 Metadata:
 creation_time : 2024-08-09T20:00:23.000000Z
 handler_name : VideoHandle
 vendor_id : [0][0][0][0]
Stream mapping:
 Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 00000219eb4d0c00] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'output_image.jpg':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf61.1.100
 Stream #0:0(eng): Video: mjpeg, yuvj420p(pc, unknown/bt709/bt709, progressive), 720x1280, q=2-31, 200 kb/s, 30 fps, 30 tbn (default)
 Metadata:
 creation_time : 2024-08-09T20:00:23.000000Z
 handler_name : VideoHandle
 vendor_id : [0][0][0][0]
 encoder : Lavc61.3.100 mjpeg
 Side data:
 cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[image2 @ 00000219e7aa51c0] The specified filename 'output_image.jpg' does not contain an image sequence pattern or a pattern is invalid.
[image2 @ 00000219e7aa51c0] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.
[out#0/image2 @ 00000219e7b5e400] video:49KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame= 1 fps=0.0 q=3.0 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=0.322x



I also realized that the problem was not related to the video orientation, but to to the video from a specific source uploaded specifically on my server 🤡 Such a weird coincidence that I decided to test my video upload with those files, but anyway. And those are.... Downloaded instagram reels lol. But again, ffmpeg works just fine when ran in terminal