saimn / sigal

yet another simple static gallery generator
http://sigal.saimon.org/
MIT License
882 stars 169 forks source link

Failed on processing video file #370

Closed k2patel closed 3 years ago

k2patel commented 5 years ago

sigal --version sigal, version 2.0

Error Message :

ERROR: Some files have failed to be processed:
ERROR:   - VID_1.webm
ERROR: You can run "sigal build" in verbose (--verbose) or debug (--debug) mode to get more details.

--- debug ---
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/home/k2patel/.local/lib/python3.7/site-packages/sigal/gallery.py", line 747, in worker
    return process_file(args)
  File "/home/k2patel/.local/lib/python3.7/site-packages/sigal/gallery.py", line 739, in process_file
    ret = processor(*args[3:])
  File "/home/k2patel/.local/lib/python3.7/site-packages/sigal/video.py", line 172, in process_video
    options=settings.get(video_format + '_options'))
  File "/home/k2patel/.local/lib/python3.7/site-packages/sigal/video.py", line 96, in generate_video
    w_src, h_src = video_size(source, converter=converter)
  File "/home/k2patel/.local/lib/python3.7/site-packages/sigal/video.py", line 67, in video_size
    ret, stdout, stderr = call_subprocess([converter, '-i', source])
  File "/home/k2patel/.local/lib/python3.7/site-packages/sigal/utils.py", line 107, in call_subprocess
    stderr = stderr.decode('utf8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 1362: invalid start byte
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/sigal", line 11, in <module>
    sys.exit(main())
  File "/home/k2patel/.local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/k2patel/.local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/k2patel/.local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/k2patel/.local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/k2patel/.local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/k2patel/.local/lib/python3.7/site-packages/sigal/__init__.py", line 142, in build
    gal.build(force=force)
  File "/home/k2patel/.local/lib/python3.7/site-packages/sigal/gallery.py", line 673, in build
    for res in self.pool.imap_unordered(worker, media_list):
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 1362: invalid start byte
--- debug end ---

Same file works fine with ffmpeg. tried converting file to .H264 ( still fail). Any idea ?

Thank you

Glandos commented 5 years ago

It seems that it is not directly related to your media file, but to your terminal encoding. I guess that you are not using UTF-8. However, this failure occurs because something is output on stderr. But the error will be clearer once you set your terminal to be UTF-8, if possible.

k2patel commented 5 years ago

Hello Glandos, Terminal does set for UTF-8, that is the first thing i've checked.

locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=

My terminal uses powerline on bash, i've tried the same command from sh, same result (failure with same message).

INFO - Reading settings ... DEBUG - Settings file: sigal.conf.py DEBUG - Rewrite source : Collection -> /home/web/Collection DEBUG - Rewrite destination : Site2 -> /home/web/Site2 DEBUG - Settings: {'albums_sort_attr': 'name', 'albums_sort_reverse': False, 'author': 'k2patel', 'autorotate_images': True, 'colorbox_column_size': 3, 'copy_exif_data': False, 'copyright': '© k2patel', 'datetime_format': '%c', 'destination': '/home/web/Site2', 'files_to_copy': (), 'google_analytics': '', 'google_tag_manager': '', 'html_language': 'en', 'ignore_directories': [], 'ignore_files': [], 'img_extensions': ['.jpg', '.jpeg', '.png', '.gif'], 'img_processor': 'ResizeToFit', 'img_size': (800, 600), 'index_in_url': False, 'jpg_options': {'optimize': True, 'progressive': True, 'quality': 85}, 'keep_orig': False, 'leaflet_provider': 'OpenStreetMap.Mapnik', 'links': '', 'locale': '', 'make_thumbs': True, 'medias_sort_attr': 'filename', 'medias_sort_reverse': False, 'mp4_options': ['-crf', '23'], 'orig_dir': 'original', 'orig_link': False, 'output_filename': 'index.html', 'piwik': {'site_id': 0, 'tracker_url': ''}, 'plugin_paths': [], 'plugins': ['sigal.plugins.copyright'], 'show_map': False, 'site_logo': '', 'source': '/home/web/Collection', 'theme': 'photoswipe', 'thumb_dir': 'thumbnails', 'thumb_fit': True, 'thumb_fit_centering': (0.5, 0.5), 'thumb_prefix': '', 'thumb_size': (280, 210), 'thumb_suffix': '', 'thumb_video_delay': '0', 'title': '', 'use_orig': False, 'video_converter': 'ffmpeg', 'video_extensions': ['.mov', '.avi', '.mp4', '.webm', '.ogv', '.3gp'], 'video_format': 'webm', 'video_size': (480, 360), 'watermark': '', 'webm_options': ['-crf', '10', '-b:v', '1.6M', '-qmin', '4', '-qmax', '63'], 'write_html': True, 'zip_gallery': False, 'zip_media_format': 'resized'} INFO - Source : /home/web/Collection INFO - Destination : /home/web/Site2 INFO - Theme : photoswipe DEBUG - Plugin paths: [] DEBUG - Registered plugin sigal.plugins.copyright INFO - Using 3 cores

Thank you,

saimn commented 5 years ago

Are you sure that you are running version 2.0? The lines in your traceback correspond to an older version.

Could you also try to run this in a python shell:

import subprocess
subprocess.run(['ffmpeg', '-i', source], stderr=subprocess.PIPE)

where source is your file.

saimn commented 3 years ago

Please reopen if still needed.