Recherche avancée
Médias (91)
-
Les Miserables
9 décembre 2019, par
Mis à jour : Décembre 2019
Langue : français
Type : Textuel
-
VideoHandle
8 novembre 2019, par
Mis à jour : Novembre 2019
Langue : français
Type : Video
-
Somos millones 1
21 juillet 2014, par
Mis à jour : Juin 2015
Langue : français
Type : Video
-
Un test - mauritanie
3 avril 2014, par
Mis à jour : Avril 2014
Langue : français
Type : Textuel
-
Pourquoi Obama lit il mes mails ?
4 février 2014, par
Mis à jour : Février 2014
Langue : français
-
IMG 0222
6 octobre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Image
Sur d’autres sites (333)
-
MoviePy error : failed to read the first frame of video file... That may also mean that you are using a deprecated version of FFMPEG
30 août 2023, par Alister KwapiszWhen I run a python telegram bot script locally, it works completely fine but when I run the script on
PythonAnywhere
I get an error that shows up when I try to generate a video :

"2023-08-29 15:21:53,138 (__init__.py:960 MainThread) ERROR - TeleBot: "Infinity polling exception: MoviePy error: failed to read the first frame of video file /home/AlisterK/video_clips/Video 2023-01-10 
18 45 07.mp4. That might mean that the file is corrupted. That may also mean that you are using a deprecated version of FFMPEG. On Ubuntu/Debian for instance the version in the repos is deprecated. Pleas
e update to a recent version from the website."
2023-08-29 15:21:53,138 (__init__.py:962 MainThread) ERROR - TeleBot: "Exception traceback:
Traceback (most recent call last):
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 955, in infinity_polling
 self.polling(non_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout,
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1043, in polling
 self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1118, in __threaded_polling
 raise e
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1074, in __threaded_polling
 self.worker_pool.raise_exceptions()
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/util.py", line 147, in raise_exceptions
 raise self.exception_info
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/util.py", line 90, in run
 task(*args, **kwargs)
 File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 6788, in _run_middlewares_and_handler
 result = handler['function'](message)
 File "/home/AlisterK/Video generator.py", line 34, in generate_video_command
 generated_video = generate_video(audio_files[user_id])
 File "/home/AlisterK/Video generator.py", line 72, in generate_video
 clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]
 File "/home/AlisterK/Video generator.py", line 72, in <listcomp>
 clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]
 File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/VideoFileClip.py", line 88, in __init__
 self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,
 File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 73, in __init__
 self.lastread = self.read_frame()
 File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 133, in read_frame
 raise IOError(("MoviePy error: failed to read the first frame of "
OSError: MoviePy error: failed to read the first frame of video file /home/AlisterK/video_clips/Video 2023-01-10 18 45 07.mp4. That might mean that the file is corrupted. That may also mean that you are using a deprecated version of FFMPEG. On Ubuntu/Debian for instance the version in the repos is deprecated. Please update to a recent version from the website."
</listcomp>


I tried updating ffmpeg and moviepy. I even tried different versions but to no avail. The video clips are not corrupted as I checked.


This part of the code is responsible for generating the videos :


def generate_video(audio_path):
 input_folder = '/home/AlisterK/video_clips' # Replace with your folder path
 output_file = '/home/AlisterK/output_combined_video.mp4'
 clip_duration = 3 # Duration of each clip in seconds
 num_clips = 10 # Number of video clips to select and combine

 width = 1080 # Replace with your desired width
 height = 1920 # Replace with your desired height

 video_clips = random_files_in_folder(input_folder, '.mp4', num_clips)

 clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]
 standardized_clips = [clip.resize((width, height)) for clip in clips] # Ensure consistent resolutions

 final_clip = concatenate_videoclips(standardized_clips)

 final_audio = AudioFileClip(audio_path)



-
ffmpeg error when try co concat videos with filter_complex
29 août 2023, par Matteo PasiniI'm trying to concatenate two videos with different resolutions. Reading around I saw that before being able to concatenate them I should scale them to the same resolution, but the command I'm using (the same one they propose on stackoverflow) doesn't seem to work. Does anyone have any ideas ?


Command :


ffmpeg -i file1.mp4 -i file2.mp4 -filter_complex "[0:v]scale=1024:576:force_original_aspect_ratio=1[v0]; [1:v]scale=1024:576:force_original_aspect_ratio=1[v1]; [v0][0:a][v1][1:a]concat=n=2:v=1:a=1[v][a]" -map [v] -map [a] output.mp4



Output :


ffmpeg version 2023-08-28-git-b5273c619d-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-dxva2 --enable-d3d11va --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. 17.100 / 58. 17.100
 libavcodec 60. 23.100 / 60. 23.100
 libavformat 60. 10.101 / 60. 10.101
 libavdevice 60. 2.101 / 60. 2.101
 libavfilter 9. 11.100 / 9. 11.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 'file1.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: isommp42
 creation_time : 2021-10-08T12:31:56.000000Z
 Duration: 00:03:15.51, start: 0.000000, bitrate: 464 kb/s
 Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m, progressive), 1444x876 [SAR 1:1 DAR 361:219], 335 kb/s, 30 fps, 30 tbr, 30k tbn (default)
 Metadata:
 creation_time : 2021-10-08T12:31:56.000000Z
 handler_name : Mainconcept MP4 Video Media Handler
 vendor_id : [0][0][0][0]
 encoder : AVC Coding
 Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
 Metadata:
 creation_time : 2021-10-08T12:31:56.000000Z
 handler_name : Mainconcept MP4 Sound Media Handler
 vendor_id : [0][0][0][0]
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'file2.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: isommp42
 creation_time : 2021-10-11T11:12:30.000000Z
 Duration: 00:02:42.01, start: 0.000000, bitrate: 380 kb/s
 Stream #1:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m, progressive), 1450x870 [SAR 1:1 DAR 5:3], 251 kb/s, 30 fps, 30 tbr, 30k tbn (default)
 Metadata:
 creation_time : 2021-10-11T11:12:30.000000Z
 handler_name : Mainconcept MP4 Video Media Handler
 vendor_id : [0][0][0][0]
 encoder : AVC Coding
 Stream #1:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
 Metadata:
 creation_time : 2021-10-11T11:12:30.000000Z
 handler_name : Mainconcept MP4 Sound Media Handler
 vendor_id : [0][0][0][0]
File 'output.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
 Stream #0:0 (h264) -> scale:default
 Stream #0:1 (aac) -> concat
 Stream #1:0 (h264) -> scale:default
 Stream #1:1 (aac) -> concat
 concat -> Stream #0:0 (libx264)
 concat -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[Parsed_concat_2 @ 00000228da583200] Input link in0:v0 parameters (size 960x576, SAR 1:1) do not match the corresponding output link in0:v0 parameters (949x576, SAR 69312:69277)
[Parsed_concat_2 @ 00000228da583200] Failed to configure output pad on Parsed_concat_2
[fc#0 @ 00000228d8cb7480] Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while filtering: Invalid argument
[Parsed_concat_2 @ 00000228da582c00] Input link in0:v0 parameters (size 960x576, SAR 1:1) do not match the corresponding output link in0:v0 parameters (949x576, SAR 69312:69277)
[Parsed_concat_2 @ 00000228da582c00] Failed to configure output pad on Parsed_concat_2
[fc#0 @ 00000228d8cb7480] Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
[Parsed_concat_2 @ 00000228da581900] Input link in0:v0 parameters (size 960x576, SAR 1:1) do not match the corresponding output link in0:v0 parameters (949x576, SAR 69312:69277)
[Parsed_concat_2 @ 00000228da581900] Failed to configure output pad on Parsed_concat_2
[fc#0 @ 00000228d8cb7480] Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
[out#0/mp4 @ 00000228d9baab40] 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= 0kB time=N/A bitrate=N/A speed=N/A
Conversion failed!



-
ffmpeg - cut without reencoding and strange behaviour : application provided duration is out of range for mov/mp4 format [closed]
27 août 2023, par user2707175In Ubuntu 18.04 I quite often used the following command for trimming part of the video without re encoding (which means without any quality loss).


ffmpeg -ss 00:06:00 -i DSCF5984.MOV -t 00:07:00 -c copy DSCF5984_A_wszystkie.MOV


Not so much time ago I moved to Ubuntu 22.04. Still having the same video camera and still using the same format for recording, when using the command as above I'm getting quite strange error and the behavior is unexpected. In this case mov file is 40 sec file. I want to get 7 seconds fragment starting from 6 second (thus from 6 to 13 sec). Instead of this I get very short fragment from the beginning of the file. I don't even know how long as none of video players want to display its length. Probably it's 1-2 sec. Thus it's not only, I get this error, but ffmpeg doesn't work. In theory I have the newest version available for ubuntu 22.04.


Messages displayed by ffmpeg


ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
 built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
 configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
 WARNING: library configuration mismatch
 avcodec configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
 libavutil 56. 70.100 / 56. 70.100
 libavcodec 58.134.100 / 58.134.100
 libavformat 58. 76.100 / 58. 76.100
 libavdevice 58. 13.100 / 58. 13.100
 libavfilter 7.110.100 / 7.110.100
 libswscale 5. 9.100 / 5. 9.100
 libswresample 3. 9.100 / 3. 9.100
 libpostproc 55. 9.100 / 55. 9.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DSCF5984.MOV':
 Metadata:
 major_brand : qt 
 minor_version : 0
 compatible_brands: qt 
 creation_time : 2023-08-12T23:07:18.000000Z
 original_format : Digital Camera
 original_format-eng: Digital Camera
 comment : FUJIFILM DIGITAL CAMERA X-S10
 comment-eng : FUJIFILM DIGITAL CAMERA X-S10
 Duration: 00:00:40.04, start: 0.000000, bitrate: 105270 kb/s
 Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/smpte170m), 3840x2160, 101873 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
 Metadata:
 creation_time : 2023-08-12T23:07:18.000000Z
 vendor_id : [0][0][0][0]
 encoder : AVC Coding
 timecode : 07:05:54;21
 Stream #0:1(eng): Audio: pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s (default)
 Metadata:
 creation_time : 2023-08-12T23:07:18.000000Z
 vendor_id : [0][0][0][0]
 timecode : 07:05:54;21
 Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
 Metadata:
 creation_time : 2023-08-12T23:07:18.000000Z
 timecode : 07:05:54;21
[mov @ 0x55a005fa6e40] Application provided duration: -9223372036854775808 / timestamp: -9223372036854775808 is out of range for mov/mp4 format
[mov @ 0x55a005fa6e40] pts has no value
Output #0, mov, to 'DSCF5984_A_wszystkie.MOV':
 Metadata:
 major_brand : qt 
 minor_version : 0
 compatible_brands: qt 
 comment-eng : FUJIFILM DIGITAL CAMERA X-S10
 original_format : Digital Camera
 original_format-eng: Digital Camera
 comment : FUJIFILM DIGITAL CAMERA X-S10
 encoder : Lavf58.76.100
 Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/smpte170m), 3840x2160, q=2-31, 101873 kb/s, 0.03 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
 Metadata:
 creation_time : 2023-08-12T23:07:18.000000Z
 vendor_id : [0][0][0][0]
 encoder : AVC Coding
 timecode : 07:05:54;21
 Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s (default)
 Metadata:
 creation_time : 2023-08-12T23:07:18.000000Z
 vendor_id : [0][0][0][0]
 timecode : 07:05:54;21
Stream mapping:
 Stream #0:0 -> #0:0 (copy)
 Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 30 fps=0.0 q=-1.0 Lsize= 13475kB time=-00:05:19.97 bitrate=N/A speed=N/A 
video:13191kB audio:282kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.019629%



Is that some kind of error ? Or should I do sth different ? I'm quite surprised as I didn't change my camera. So is that sth changed in ffmpeg ?