
Recherche avancée
Autres articles (68)
-
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...) -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)
Sur d’autres sites (6854)
-
Everytime I run my code ffmpeg responds with this instead of doing its function. How do I fix ?
25 juillet 2023, par Oreo FOutput from ffmpeg/avlib:

ffmpeg version 2023-07-19-git-efa6cec759-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
 built with gcc 12.2.0 (Rev10, 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-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --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-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --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 58. 14.100 / 58. 14.100
 libavcodec 60. 22.100 / 60. 22.100
 libavformat 60. 10.100 / 60. 10.100
 libavdevice 60. 2.101 / 60. 2.101
 libavfilter 9. 8.102 / 9. 8.102
 libswscale 7. 3.100 / 7. 3.100
 libswresample 4. 11.100 / 4. 11.100
 libpostproc 57. 2.100 / 57. 2.100



Everytime I run the code it does this.


code :


import praw
import requests
import cv2
import os
from pydub import AudioSegment

def download_video(url, filename):
 response = requests.get(url)
 with open(filename, 'wb') as f:
 f.write(response.content)

def combine_videos(video_urls, output_filename):
 video_clips = []
 audio_clips = []
 for i, url in enumerate(video_urls):
 temp_filename = f'temp_video_{i}.mp4'
 download_video(url, temp_filename)
 video_clip = cv2.VideoCapture(temp_filename)
 audio_clip = AudioSegment.from_file(temp_filename, format="mp4")
 video_clips.append(video_clip)
 audio_clips.append(audio_clip)
 
 if not video_clips:
 print("No video clips to combine.")
 return

 frame_width = int(video_clips[0].get(cv2.CAP_PROP_FRAME_WIDTH))
 frame_height = int(video_clips[0].get(cv2.CAP_PROP_FRAME_HEIGHT))
 fps = int(video_clips[0].get(cv2.CAP_PROP_FPS))

 fourcc = cv2.VideoWriter_fourcc(*'mp4v')
 output_clip = cv2.VideoWriter(output_filename, fourcc, fps, (frame_width, frame_height))

 for i, video_clip in enumerate(video_clips):
 while True:
 ret, frame = video_clip.read()
 if not ret:
 break
 output_clip.write(frame)
 
 for video_clip in video_clips:
 video_clip.release()
 
 output_clip.release()

 # Combining audio using pydub
 combined_audio = sum(audio_clips)
 combined_audio.export("combined_audio.mp3", format="mp3")

 # Merging audio with video using ffmpeg
 os.system(f'ffmpeg -i {output_filename} -i combined_audio.mp3 -c:v copy -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 final_output.mp4')

 # Cleaning up temporary files
 os.remove("combined_audio.mp3")

def main():
 reddit = praw.Reddit(
 client_id='XXX',
 client_secret='XXX',
 user_agent='Reddit Video Downloader'
 )
 
 subreddit_name = input("Enter the name of the subreddit: ")
 limit = int(input("Enter the number of videos to download: "))
 
 subreddit = reddit.subreddit(subreddit_name)
 submissions = subreddit.hot(limit=limit)
 
 video_urls = [submission.url for submission in submissions if submission.media and 'reddit_video' in submission.media]
 
 if video_urls:
 output_filename = input("Enter the output filename (e.g., output.mp4): ")
 combine_videos(video_urls, output_filename)
 print("Videos combined successfully!")
 else:
 print("No Reddit videos found in the subreddit.")

if __name__ == "__main__":
 main()



Anyone got any idea why this happens ?


I'm making a script that scrapes videos from a specific subreddit.


Also if it helps the temp video file is corrupted when it gets made.


I've put this into chatGPT as well and brought an expert friend and he hasn't been able to help me.


-
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 ?


-
MP4 to HLS conversion error after resizing video using FFmpeg
26 juillet 2023, par ITeptIcklyTaWhen trying to create HLS stream from original video, FFmpeg creates HLS stream without errors.


~ $ ffmpeg -i test.mp4 -f hls -hls_time 3 -hls_segment_filename seg%02d.ts stream.m3u8



But when I resize video using this command, I get a timestamps warning :


~ $ ffmpeg -i test.mp4 -vf scale=426:240 test_240p.mp4
[mp4 @ 0xb400007429e52d00] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[mp4 @ 0xb400007429e52d00] Encoder did not produce proper pts, making some up.



And when creating HLS stream from resized video, I'm getting an error :


~ $ ffmpeg -i test_240p.mp4 -f hls -hls_time 3 -hls_segment_filename seg%02d.ts stream.m3u8 ffmpeg version N-111626-g0ba719f726 Copyright (c) 2000-2023 the FFmpeg developers
 built with clang version 16.0.6
 configuration: --arch=aarch64 --as=aarch64-linux-android-clang --cc=aarch64-linux-android-clang --cxx=aarch64-linux-android-clang++ --nm=llvm-nm --pkg-config=/data/data/com.termux/files/usr/bin/pkg-config --strip=llvm-strip --cross-prefix=aarch64-linux-android- --disable-indevs --disable-outdevs --enable-indev=lavfi --disable-static --disable-symver --enable-cross-compile --enable-gnutls --enable-gpl --enable-jni --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgme --enable-libmp3lame --enable-libopus --enable-librav1e --enable-libsoxr --enable-libsrt --enable-libssh --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-mediacodec --enable-opencl --enable-shared --prefix=/data/data/com.termux/files/usr --target-os=android --extra-libs=-landroid-glob --disable-vulkan --enable-neon --disable-libfdk-aac libavutil 58. 14.100 / 58. 14.100 libavcodec 60. 22.100 / 60. 22.100
 libavformat 60. 10.100 / 60. 10.100 libavdevice 60. 2.101 / 60. 2.101
 libavfilter 9. 10.100 / 9. 10.100
 libswscale 7. 3.100 / 7. 3.100
 libswresample 4. 11.100 / 4. 11.100
 libpostproc 57. 2.100 / 57. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_240p.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf60.10.100
 Duration: 00:00:10.01, start: 0.000000, bitrate: 178 kb/s
 Stream #0:0[0x1](und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/smpte170m, progressive), 426x240, 44 kb/s, SAR 640:639 DAR 16:9, 25 fps, 25 tbr, 12800 tbn (default)
 Metadata:
 handler_name : ISO Media file produced by Google Inc. Created on: 02/24/2023.
 vendor_id : [0][0][0][0]
 encoder : Lavc60.22.100 h264_mediacodec
 Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
 Metadata:
 handler_name : ISO Media file produced by Google Inc. Created on: 02/24/2023.
 vendor_id : [0][0][0][0]
Stream mapping:
 Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_mediacodec))
 Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_mediacodec @ 0xb400007da1f2ac00] Use 1 as the default MediaFormat i-frame-interval, please set gop_size properly (>= fps)
[h264_mediacodec @ 0xb400007da1f2ac00] Mediacodec encoder doesn't support AV_CODEC_FLAG_GLOBAL_HEADER. Use extract_extradata bsf when necessary.
Output #0, hls, to 'stream.m3u8':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf60.10.100
 Stream #0:0(und): Video: h264, yuv420p(tv, bt709/bt709/smpte170m, progressive), 426x240 [SAR 640:639 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 90k tbn (default)
 Metadata:
 handler_name : ISO Media file produced by Google Inc. Created on: 02/24/2023.
 vendor_id : [0][0][0][0]
 encoder : Lavc60.22.100 h264_mediacodec
 Stream #0:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 handler_name : ISO Media file produced by Google Inc. Created on: 02/24/2023.
 vendor_id : [0][0][0][0]
 encoder : Lavc60.22.100 aac
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.25 bitr[hls @ 0xb400007da1f27d00] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[hls @ 0xb400007da1f27d00] Encoder did not produce proper pts, making some up.
[mpegts @ 0xb400007da1f29100] H.264 bitstream error, startcode missing, size 0
[hls @ 0xb400007da1f27d00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 3600 >= 3600
[vost#0:0/h264_mediacodec @ 0xb400007da200a000] Error submitting a packet to the muxer: Invalid argument
[out#0/hls @ 0xb400007da1eaa6c0] Error muxing a packet
[hls @ 0xb400007da1f27d00] Opening 'seg00.ts' for writing
[hls @ 0xb400007da1f27d00] Opening 'stream.m3u8.tmp' for writing
[out#0/hls @ 0xb400007da1eaa6c0] video:2kB audio:5kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
frame= 3 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.41 bitrate=N/A speed=3.39x
[aac @ 0xb400007da2051400] Qavg: 32468.840
Conversion failed!
~ $



I tried to build FFmpeg from GitHub and install FFmpeg from repositories, and I'm still getting this error.