
Recherche avancée
Médias (91)
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#1 The Wires
11 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
ED-ME-5 1-DVD
11 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (99)
-
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 ;
-
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. -
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)
Sur d’autres sites (13890)
-
AVCodec h264_v4l2m2m hardware decoding unable to find device
26 juillet 2023, par nathansizemoreUsing a custom compiled FFmpeg :


$ ./ffmpeg -codecs | grep h264
ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
 built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
 configuration: --arch=aarch64 --enable-cross-compile --target-os=linux --cross-prefix=aarch64-linux-gnu- --prefix=/builds/dronesense/rust/ffmpeg-build/ffmpeg/out --pkgconfigdir= --pkg-config=pkg-config --extra-libs='-ldl -lpthread' --enable-libvpx --enable-libx264 --enable-libx265 --enable-decklink --enable-gpl --enable-nonfree --enable-shared --disable-static
 libavutil 58. 2.100 / 58. 2.100
 libavcodec 60. 3.100 / 60. 3.100
 libavformat 60. 3.100 / 60. 3.100
 libavdevice 60. 1.100 / 60. 1.100
 libavfilter 9. 3.100 / 9. 3.100
 libswscale 7. 1.100 / 7. 1.100
 libswresample 4. 10.100 / 4. 10.100
 libpostproc 57. 1.100 / 57. 1.100
 DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m ) (encoders: libx264 libx264rgb h264_v4l2m2m )



/dev/video32
seems to have H.264 decoding support :

$ v4l2-ctl --list-formats-out -d /dev/video32
ioctl: VIDIOC_ENUM_FMT
 Index : 0
 Type : Video Output Multiplanar
 Pixel Format: 'MPG2' (compressed)
 Name : MPEG-2 ES

 Index : 1
 Type : Video Output Multiplanar
 Pixel Format: 'H264' (compressed)
 Name : H.264

 Index : 2
 Type : Video Output Multiplanar
 Pixel Format: 'HEVC' (compressed)
 Name : HEVC

 Index : 3
 Type : Video Output Multiplanar
 Pixel Format: 'VP80' (compressed)
 Name : VP8

 Index : 4
 Type : Video Output Multiplanar
 Pixel Format: 'VP90' (compressed)
 Name : VP9



I've tried two approaches (Rust with bindgen) :


Approach 1 :


fn init_decoder() -> Arc<contextwrapper> {
 let name = CString::new("h264_v4l2m2m").unwrap();
 let codec = unsafe { ffmpeg::avcodec_find_decoder_by_name(name.as_ptr()) };
 if codec.is_null() {
 error!("finding codec");
 process::exit(1);
 }

 let ctx = unsafe { ffmpeg::avcodec_alloc_context3(codec) };
 if ctx.is_null() {
 error!("creating context");
 process::exit(1);
 }

 let r = unsafe { ffmpeg::avcodec_open2(ctx, codec, ptr::null_mut()) };
 if r < 0 {
 error!("opening codec: {r}");
 process::exit(1);
 }

 Arc::new(ContextWrapper(ctx))
}
</contextwrapper>


Results in :


[h264_v4l2m2m @ 0x7f1c001600] Could not find a valid device
[h264_v4l2m2m @ 0x7f1c001600] can't configure decoder
[ERROR] [decoder] [webrtc::codec] opening codec: -1



Approach 2


fn init_decoder() -> Arc<contextwrapper> {
 let name = CString::new("h264_v4l2m2m").unwrap();
 let codec = unsafe { ffmpeg::avcodec_find_decoder_by_name(name.as_ptr()) };
 if codec.is_null() {
 error!("finding codec");
 process::exit(1);
 }

 let mut i = 0;
 let mut hw_pix_fmt: AVPixelFormat = unsafe { mem::zeroed() };
 loop {
 let config = unsafe { ffmpeg::avcodec_get_hw_config(codec, i) };
 if config.is_null() {
 error!("decoder not supported");
 process::exit(1);
 }

 unsafe {
 info!("device type: {:?}", (*config).device_type);
 if ((*config).methods & ffmpeg::AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX as i32) > 0 {
 hw_pix_fmt = (*config).pix_fmt;
 break;
 }
 }
 }

 info!("pixel format: {:?}", hw_pix_fmt);

 let ctx = unsafe { ffmpeg::avcodec_alloc_context3(codec) };
 if ctx.is_null() {
 error!("creating context");
 process::exit(1);
 }

 let r = unsafe { ffmpeg::avcodec_open2(ctx, codec, ptr::null_mut()) };
 if r < 0 {
 error!("opening codec: {r}");
 process::exit(1);
 }

 Arc::new(ContextWrapper(ctx))
}

</contextwrapper>


Results in :

error!("decoder not supported");


I feel like there is a major step missing because looking at FFmpeg's Hardware Decode Example there are looking for a device type, to which v4l2 is not a part of the enum, so I do not what functions to call to get it setup.


What is the proper way to setup an AVCodec decoder with H.264 hardware acceleration for v4l2m2m ?


-
Top 4 CRO Tools to Boost Your Conversion Rates in 2024
31 octobre 2023, par Erin -
FFmpeg transcoding video H.264 -> AV1 leads to distorted image
21 juin 2023, par user1584149I'm reading video from stdin via pipe similar to this one Python gets stuck at pipe.stdin.write(image.tostring())


FFmpeg is using libsvtav1 codec with options according to documentation


ffmpeg -y -f rawvideo -i pipe:0 -s {frame_width}x{frame_height} -r {frame_rate} -c:a copy -c:v libsvtav1 -preset 6 -crf 30 -svtav1-params "color-format=1:film-grain-denoise=0:mbr=2M" {output_file} 



Here's couple of details about used FFmpeg version as well as input video


ffmpeg version n5.1.3-14-ge5b5dd6653-20230621 Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 13.1.0 (crosstool-NG 1.25.0.196_227d99d)
 configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --disable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --disable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20230621
 libavutil 57. 28.100 / 57. 28.100
 libavcodec 59. 37.100 / 59. 37.100
 libavformat 59. 27.100 / 59. 27.100
 libavdevice 59. 7.100 / 59. 7.100
 libavfilter 8. 44.100 / 8. 44.100
 libswscale 6. 7.100 / 6. 7.100
 libswresample 4. 7.100 / 4. 7.100
 libpostproc 56. 6.100 / 56. 6.100
Input #0, rawvideo, from 'pipe:0':
 Duration: N/A, start: 0.000000, bitrate: 331776 kb/s
 Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, 331776 kb/s, 30 tbr, 30 tbn
Stream mapping:
 Stream #0:0 -> #0:0 (rawvideo (native) -> av1 (libsvtav1))
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]: SVT-AV1 Encoder Lib v1.5.0-12-g0f8b3a81
Svt[info]: SVT [build] : GCC 13.1.0 64 bit
Svt[info]: LIB Build date: Jun 20 2023 23:48:14
Svt[info]: -------------------------------------------



The output video transcoded by SVT-AV1 codec is blemished as you can see on the images below. Normally I would say it could be caused by wrong pixel format, but input stream has yuv420 format what is the same as encoder's pixel format parameter —color-format.


Please share your experience or ideas how to get it transcoding correctly.


Thanks in advance.