Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading video in local and docker-compose file works fine but in minikube below issue occured #90

Open
nikhiltree opened this issue Jun 29, 2023 · 9 comments

Comments

@nikhiltree
Copy link

Problem : based on my understanding ffmpeg-linux64-v4.2.2 needs some of depedancies which is i don't know
ffmpeg_reader.py used this ffmpeg-linux64-v4.2.2 for subprocess start more info : link line 257
minikube path : /usr/local/lib/python3.8/site-packages/imageio_ffmpeg/binaries/ffmpeg-linux64-v4.2.2

Expected Behavior

>>> from moviepy.editor import *
>>> clip=VideoFileClip("https://videorenderingbucket.s3.ap-south-1.amazonaws.com/video_file/Pranali_Shukan_Wedding_Invite.mp4_video_2023-06-19_10%3A25%3A13.685572.mp4")
>>> clip
<moviepy.video.io.VideoFileClip.VideoFileClip object at 0x7f175c97ac40>

Actual Behavior

From moviepy. Editor import *
clip=videofileclip("https: //videorenderingbucket. S3. Ap-south-1. Amazonaws. Com/video_file/the+breathtaking+beauty+of+nature+-+hd. Mp4")`

### Logs
traceback (most recent call last):
file "/usr/local/lib/python3.8/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 "<stdin>", line 1, in <module>
file "/usr/local/lib/python3.8/site-packages/moviepy/video/io/videofileclip. Py", line 88, in __init__
self. Reader = ffmpeg_videoreader(filename, pix_fmt=pix_fmt,
file "/usr/local/lib/python3.8/site-packages/moviepy/video/io/ffmpeg_reader. Py", line 35, in __init__
infos = ffmpeg_parse_infos(filename, print_infos, check_duration,
file "/usr/local/lib/python3.8/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: //videorenderingbucket. S3. Ap-south-1. Amazonaws. Com/video_file/the+breathtaking+beauty+of+nature+-+hd. Mp4.
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`

Specifications

  • Python Version: 3.8.10
  • MoviePy Version:1.0.3
  • Platform Name: Minikube
  • Platform Version: v1.30.1

Requirement.txt

  • aiofiles==23.1.0
  • autopep8==2.0.2
  • bcrypt==4.0.1
  • boto3==1.26.144
  • chill==0.9.0
  • cloudpickle==2.2.1
  • cryptography==41.0.1
  • fastapi==0.95.0
  • ffmpeg-python==0.2.0
  • ffpyplayer==4.4.0
  • flower==1.2.0
  • httpx==0.23.3
  • ipykernel==6.22.0
  • moviepy==1.0.3
  • mysql-connector-python==8.0.33
  • opencv-python==4.7.0.72
  • pandas==1.5.3
  • pip-chill==1.0.1
  • pyjwt==2.7.0
  • pymysql==1.0.3
  • python-decouple==3.8
  • python-dotenv==1.0.0
  • python-multipart==0.0.6
  • rabbitmq==0.2.0
  • redis==4.5.4
  • sqlalchemy==2.0.12
  • uvicorn==0.21.1
@almarklein
Copy link
Member

My first guess is that the OS of the container is not compatible with the binary ffmpeg executable that is shipped with imageio-ffmpeg. The system's ffmpeg is then used, which seems to behave differently. If ffmpeg is not available I would expect a different error, but it could be that the detection in ffmpeg_reader.py let it slip through.

To be honest, this looks to me like a bug in moviepy, since the code wrongfully assumes that the lines object is not empty.

@nikhiltree
Copy link
Author

I am using minikube it's running inside docker-container i don't how to make this ffmpeg executable inside docker-container i didn't find any solution since 3 week and my project is hold on now

@almarklein
Copy link
Member

What OS are you using in the container? You could try using a recent Ubuntu to see if that works, which would at the least narrow down the problem.

@nikhiltree
Copy link
Author

nikhiltree commented Jul 4, 2023

My first guess is that the OS of the container is not compatible with the binary ffmpeg executable that is shipped with imageio-ffmpeg. The system's ffmpeg is then used, which seems to behave differently. If ffmpeg is not available I would expect a different error, but it could be that the detection in ffmpeg_reader.py let it slip through.

To be honest, this looks to me like a bug in moviepy, since the code wrongfully assumes that the lines object is not empty.

I don't think there is bug in moviepy if there is bug in moviepy then it will not work in docker-compose i thinks issue is between minikube and ffmpeg executable
Os : Ubuntu 20.04 LTS

@nikhiltree
Copy link
Author

from __future__ import division

import logging
import os
import re
import subprocess as sp
import warnings

import numpy as np

from moviepy.compat import DEVNULL, PY3
from moviepy.config import get_setting  # ffmpeg, ffmpeg.exe, etc...
from moviepy.tools import cvsecs


is_GIF = False
cmd = [get_setting("FFMPEG_BINARY"), "-i", "https://videorenderingbucket.s3.ap-south-1.amazonaws.com/video_file/The+Breathtaking+Beauty+of+Nature+-+HD.mp4"]
if is_GIF:
  cmd += ["-f", "null", "/dev/null"]

popen_params = {"bufsize": 10**5,"stdout": sp.PIPE,"stderr": sp.PIPE,"stdin": DEVNULL}
if os.name == "nt":
	popen_params["creationflags"] = 0x08000000

proc = sp.Popen(cmd, **popen_params)
(output, error) = proc.communicate()
infos = error.decode('utf8')
print(infos)

this code is working fine in host machine as well as docker-compose but issue with minikube

@almarklein
Copy link
Member

I don't think there is bug in moviepy if there is bug in moviepy then it will not work in docker-compose i thinks issue is between minikube and ffmpeg executable

You're right, it's more subtle ... I agree there's likely a problem in ffmpeg not working or producing different output than expected with minicube. But moviepy has not taken this case into account - which results in an error that hides the real cause.

this code is working fine in host machine as well as docker-compose but issue with minikube

Can you also make it print cmd and show what it prints in minicube?

@nikhiltree
Copy link
Author

cmd :
["/usr/local/lib/python3.8/site-packages/imageio_ffmpeg/binaries/ffmpeg-linux64-v4.2.2"," -i", "https://videorenderingbucket.s3.ap-south-1.amazonaws.com/video_file/The+Breathtaking+Beauty+of+Nature+-+HD.mp4"]

@almarklein
Copy link
Member

And what does print(infos) show?

@liuyhwangyh
Copy link

ubuntu22.04
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
段错误 (核心已转储)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants