Recherche avancée
Autres articles (1)
-
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 (...)
Sur d’autres sites (116)
-
Index error with moviepy when running on aws
29 avril, par Hardik PatelI am getting this error :
"MoviePy error : failed to read the duration of file %s.\n"
OSError : MoviePy error : failed to read the duration of file https://delivery.gettyimages.com/downloads/1490392845?k=20&e=AnE-X_nyTRBG5QvUm1OnnCZEOURkdWAdDeQJTmDW8Eo41FL7u_ROCopEha5N-Kwh-fxBr44QIe5s2vzAUchlcVs91TwSlJTMOKWYSTraamKCPRcJv19CqNZRB_FgLaW_.


The funny thing is that for the same line of code :


video_duration = VideoFileClip(getty_url).duration



when running on my mac, it is running fine. However when running from an aws server I am getting this error :


[2024-04-29 05:55:42,126: ERROR/ForkPoolWorker-1] Task scripttovideoapp.create_video[18288b91-d304-400a-97a9-285fac776f85] raised unexpected: OSError('MoviePy error: failed to read the duration of file https://delivery.gettyimages.com/downloads/1490392845?k=20&e=AnE-X_nyTRBG5QvUm1OnnCZEOURkdWAdDeQJTmDW8Eo41FL7u_ROCopEha5N-Kwh-fxBr44QIe5s2vzAUchlcVs91TwSlJTMOKWYSTraamKCPRcJv19CqNZRB_FgLaW_.\nHere are the file infos returned by ffmpeg:\n\nffmpeg version 4.2.2-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers\n built with gcc 8 (Debian 8.3.0-6)\n configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg\n libavutil 56. 31.100 / 56. 31.100\n libavcodec 58. 54.100 / 58. 54.100\n libavformat 58. 29.100 / 58. 29.100\n libavdevice 58. 8.100 / 58. 8.100\n libavfilter 7. 57.100 / 7. 57.100\n libswscale 5. 5.100 / 5. 5.100\n libswresample 3. 5.100 / 3. 5.100\n libpostproc 55. 5.100 / 55. 5.100\n')
Traceback (most recent call last):
 File "/home/ec2-user/.local/lib/python3.9/site-packages/moviepy/video/io/ffmpeg_reader.py", line 285, in ffmpeg_parse_infos
 line = [l for l in lines if keyword in l][index]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/home/ec2-user/.local/lib/python3.9/site-packages/celery/app/trace.py", line 477, in trace_task
 R = retval = fun(*args, **kwargs)
 File "/home/ec2-user/.local/lib/python3.9/site-packages/celery/app/trace.py", line 760, in __protected_call__
 return self.run(*args, **kwargs)
 File "/home/ec2-user/videoproj/scripttovideoapp.py", line 454, in create_video
 all_urls, video_details = process_script(script, paths, company_a, company_b, api_key)
 File "/home/ec2-user/videoproj/scripttovideoapp.py", line 232, in process_script
 video_duration = VideoFileClip(file).duration # This needs to be replaced with a proper duration if available
 File "/home/ec2-user/.local/lib/python3.9/site-packages/moviepy/video/io/VideoFileClip.py", line 88, in __init__
 self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,
 File "/home/ec2-user/.local/lib/python3.9/site-packages/moviepy/video/io/ffmpeg_reader.py", line 35, in __init__
 infos = ffmpeg_parse_infos(filename, print_infos, check_duration,
 File "/home/ec2-user/.local/lib/python3.9/site-packages/moviepy/video/io/ffmpeg_reader.py", line 289, in ffmpeg_parse_infos
 raise IOError(("MoviePy error: failed to read the duration of file %s.\n"
OSError: MoviePy error: failed to read the duration of file https://delivery.gettyimages.com/downloads/1490392845?k=20&e=AnE-X_nyTRBG5QvUm1OnnCZEOURkdWAdDeQJTmDW8Eo41FL7u_ROCopEha5N-Kwh-fxBr44QIe5s2vzAUchlcVs91TwSlJTMOKWYSTraamKCPRcJv19CqNZRB_FgLaW_.
Here are the file infos returned by ffmpeg:

ffmpeg version 4.2.2-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers
 built with gcc 8 (Debian 8.3.0-6)
 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
 libavutil 56. 31.100 / 56. 31.100
 libavcodec 58. 54.100 / 58. 54.100
 libavformat 58. 29.100 / 58. 29.100
 libavdevice 58. 8.100 / 58. 8.100
 libavfilter 7. 57.100 / 7. 57.100
 libswscale 5. 5.100 / 5. 5.100
 libswresample 3. 5.100 / 3. 5.100
 libpostproc 55. 5.100 / 55. 5.100




I checked the version of my package on both mac and aws, the packages are the same. Went through different stackover flow solutions but non of them totally aligns with my issue.


-
Python pydub issue : Can't repoen a wav file after it as been reencoded by ffpeg [Silved]
28 avril, par Trent TompkinsSolved by Michael Butscher. Updated code is now in the repo in the fixed branch. Thanks !


I have a python script that reads in all the *.wav files in a directory and saves them in a folder called output after it adjusts their volume.


lower.py :


import os
from pydub import AudioSegment as ass

# get the current working directory
current_working_directory = os.getcwd()
all_files = os.listdir();

 


while len(all_files) > 0:
 file = all_files.pop()
 song = ass.from_wav(file)
 song = song - 16
 song.export('out\\'+file)




https://github.com/tibberous/ChangeWavVolume/tree/fixed


The problem is (and this took me a LONG time to figure out), after the files are output once, if you try to read them again with AudioSegment ::from_wav(file), ffmpeg throws an error saying it can't decode the file. The output wav files play in Windows Media Player, and even have their audio adjusted, but I am guessing there somehow an error either in the file data itself or the file headers.


I put the code on github. Checkout the branch 'fixed'.


Btw, I just installed everything, so I should have the current versions of everything. I am using the Chocolatey package manager for Windows 10. Read README.txt (in progress) to see how I setup my dev environment.




Python 3.12.2
Chocolatey v2.2.2
C:\Users\moren>C:\ProgramData\chocolatey\bin\ffmpeg
ffmpeg version 7.0-essentials_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-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --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-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
 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
Universal media converter







I opened the wav files the program generated with Media Player, VLC Media Player and Audacity, thinking they might throw an error, but the only thing that can't seem to read the exported wav files is the script that created them !


-
Generation thumbnail from video using ffmpeg [closed]
23 avril, par godvlprTry to create thumbnail from video using ffmpeg
This command work perfectly :


ffmpeg -i test.mp4 -ss 00:00:00 -vframes 1 thumbnail.jpg


But I need to push video to ffmpeg from stdin, and find solution with pipe :


cat test.mp4 | ffmpeg -f mp4 -i pipe:0 -ss 00:00:00 -vframes 1 thumbnail.jpg


But it's not work for me. Error :


ffmpeg version 7.0 Copyright (c) 2000-2024 the FFmpeg developers
 built with Apple clang version 15.0.0 (clang-1500.3.9.4)
 configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
 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 @ 0x14f706460] stream 0, offset 0x30: partial file
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x14f706460] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1920x1080, 3496 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
 encoder : Lavf58.26.100
 Duration: 00:00:02.01, start: 0.000000, bitrate: N/A
 Stream #0:0[0x1](und): Video: h264 (avc1 / 0x31637661), none, 1920x1080, 3496 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 Stream #0:1[0x2](und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s (default)
 Metadata:
 handler_name : SoundHandler
 vendor_id : [0][0][0][0]
Stream mapping:
 Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x14f706460] stream 0, offset 0x30: partial file
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x600002e2c400] Error during demuxing: Invalid data found when processing input
Cannot determine format of input 0:0 after EOF
[vf#0:0 @ 0x60000202c240] Task finished with error code: -1094995529 (Invalid data found when processing input)
[vf#0:0 @ 0x60000202c240] Terminating thread with return code -1094995529 (Invalid data found when processing input)
[vost#0:0/mjpeg @ 0x14f7080e0] Could not open encoder before EOF
[vost#0:0/mjpeg @ 0x14f7080e0] Task finished with error code: -22 (Invalid argument)
[vost#0:0/mjpeg @ 0x14f7080e0] Terminating thread with return code -22 (Invalid argument)
[out#0/image2 @ 0x60000272c180] 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!



Tried on macos and ubuntu. What can be wrong here and how to fix this issue ? Maybe exists other solutions without pipes, or something else..