lengstrom / fast-style-transfer

TensorFlow CNN for fast style transfer ⚡🖥🎨🖼
10.91k stars 2.6k forks source link

MoviePy error ,FFMPEG error,Broken pipe #253

Open tom99763 opened 4 years ago

tom99763 commented 4 years ago

I use trainsform_video and the code shows this error: ''' OSError: [Errno 32] Broken pipe

MoviePy error: FFMPEG encountered the following error while writing file ./examples/results/foxy.mp4:

b'' ''' I search for this problem for very long time and didn't find any issue about this(most of this issue is about 'permission denied' or "Unrecognized option 'preset'.\nError splitting the argument list: Option not found\n")

I tried 'conda install -c conda-forge ffmpeg' but it still shows this error.

Did someone sucesss to fix this problem?

Fonserbc commented 4 years ago

Same error here:


  File "[mycondapath]\tf-gpu\lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 136, in write_frame
    self.proc.stdin.write(img_array.tobytes())
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "transform_video.py", line 55, in <module>
    main()
  File "transform_video.py", line 51, in main
    evaluate.ffwd_video(opts.in_path, opts.out, opts.checkpoint, opts.device, opts.batch_size)
  File "[myrepopath]\fast-style-transfer\evaluate.py", line 62, in ffwd_video
    style_and_write(frame_count)
  File "[myrepopath]\fast-style-transfer\evaluate.py", line 55, in style_and_write
    video_writer.write_frame(np.clip(_preds[i], 0, 255).astype(np.uint8))
  File "[mycondapath]\tf-gpu\lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 180, in write_frame
    raise IOError(error)
OSError: [Errno 32] Broken pipe

MoviePy error: FFMPEG encountered the following error while writing file out/guitar/fox.mp4:

 b''```
tom99763 commented 4 years ago

Same error here:

  File "[mycondapath]\tf-gpu\lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 136, in write_frame
    self.proc.stdin.write(img_array.tobytes())
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "transform_video.py", line 55, in <module>
    main()
  File "transform_video.py", line 51, in main
    evaluate.ffwd_video(opts.in_path, opts.out, opts.checkpoint, opts.device, opts.batch_size)
  File "[myrepopath]\fast-style-transfer\evaluate.py", line 62, in ffwd_video
    style_and_write(frame_count)
  File "[myrepopath]\fast-style-transfer\evaluate.py", line 55, in style_and_write
    video_writer.write_frame(np.clip(_preds[i], 0, 255).astype(np.uint8))
  File "[mycondapath]\tf-gpu\lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 180, in write_frame
    raise IOError(error)
OSError: [Errno 32] Broken pipe

MoviePy error: FFMPEG encountered the following error while writing file out/guitar/fox.mp4:

 b''```

commit d4de63ff195f28cc514fb372979c3c4fe6cbbc8a fix

PGG-DeepAI commented 4 years ago

SAME ERROR HERE: In your activated enviroment: conda install moviepy gets version 1.0.1 pip install moviepy gets version 1.0.2 BUT enviroment doesnt detect moviepy is installed (if you try running transform_movie.py)

conda installs the package here:

C:\ProgramData\Anaconda3\pkgs\moviepy-1.0.1-py_0\site-packages

pip installs the package here:

C:\ProgramData\Anaconda3\envs\tf_gpu\Lib\site-packages (replace tf_gpu for your enviroment name)

To solve this:

if you make pip install moviepy==1.0.2 outside enviroment, pip show moviepy will give you 1.0.2 version and DEFAULT location in: C:\ProgramData\Anaconda3\Lib\site-packages

if you make conda search moviepy it will tell you it didnt found it!

so to solve version mistmatch this we need moviepy 1.0.2 installed, and not use conda install! Manual installation over enviroment: If you are using conda: 1.Get files and unzip: https://github.com/Zulko/moviepy 2.python setup.py install

If you still want to use conda-enviroment you can alternatively do this:

name: tf_gpu
channels:
dependencies:
   - requests
   - bokeh>=0.10.0
   - pip:
     - "--editable=git+https://github.com/pythonforfacebook/facebook-sdk.git@8c0d34291aaafec00e02eaa71cc2a242790a0fcc#egg=facebook_sdk-master"

It's still calling pip under the covers, but you can now unify your conda and pip package specifications in a single environment.yml file.

If you wanted to update your root environment with this file, you would need to save this to a file (for example, environment.yml), then run the command: conda env update -f environment.yml

EDITED: SAME ERROR ...woots! version error is discarded also & OOM error is discarded too (nvidia-smi dmon is showing 2% mem usage when trying to transform a 500kb video, 20 secs 200px square .mp4) and still getting same error over moviepy version 1.0.2 as well as 2.0.0:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\tf_gpu\lib\site-packages\moviepy-2.0.0.dev1-py3.7.egg\moviepy\video\io\ffmpeg_writer.py", line 143, in write_frame
    self.proc.stdin.write(img_array.tobytes())
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "transform_video.py", line 55, in <module>
    main()
  File "transform_video.py", line 51, in main
    evaluate.ffwd_video(opts.in_path, opts.out, opts.checkpoint, opts.device, opts.batch_size)
  File "C:\Users\P_G\IA_Transferencia_Neural_Estilos\evaluate.py", line 62, in ffwd_video
    style_and_write(frame_count)
  File "C:\Users\P_G\IA_Transferencia_Neural_Estilos\evaluate.py", line 55, in style_and_write
    video_writer.write_frame(np.clip(_preds[i], 0, 255).astype(np.uint8))
  File "C:\ProgramData\Anaconda3\envs\tf_gpu\lib\site-packages\moviepy-2.0.0.dev1-py3.7.egg\moviepy\video\io\ffmpeg_writer.py", line 196, in write_frame
    raise IOError(error)
OSError: [Errno 32] Broken pipe

MoviePy error: FFMPEG encountered the following error while writing file video/iavid_wave1.mp4:

Working over Windows 10 through conda.

novichiv commented 3 years ago

Workaround: downgrading imageio-ffmpeg version from 0.4.3 to 0.2.0 resolves this issue.

HilariousBojack commented 1 year ago

Workaround: downgrading imageio-ffmpeg version from 0.4.3 to 0.2.0 resolves this issue.

Thanks!

nagisakuya commented 1 year ago

I found that version of ffmpeg also cause this error. Make sure that version of ffmpeg is 3.x.

Hotpottttt commented 4 months ago

Workaround: downgrading imageio-ffmpeg version from 0.4.3 to 0.2.0 resolves this issue.

why do I still got the same error after downgrading? I got almost mad

paradiseforgithub commented 4 months ago

已收到您的邮件,如有问题会尽快给您回复.