saimn / sigal

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

encrypt does not work on videos thumbnails #444

Open romain-dartigues opened 3 years ago

romain-dartigues commented 3 years ago

I was prepared that the encrypt plugin did not work on videos, however I would have appreciated if it could encrypt the extracted thumbnails.

Once sigal build pictures:

$ find _build -name \*.jpg -exec file {} +
_build/DSC_7304.jpg:                        data
_build/.thumbnails/DSC_7304.jpg:            data
_build/.thumbnails/VID_20210807_165256.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, progressive, precision 8, 190x190, components 3
Here is my configuration and I am using sigal, version 2.2 ```json { "albums_sort_attr": "name", "albums_sort_reverse": false, "autorotate_images": true, "colorbox_column_size": 3, "copy_exif_data": false, "datetime_format": "%F %T", "destination": "/home/user/playground/_build", "encrypt_options": { "ask_password": true, "kdf_iters": 100, "password": "9Y8mDq15xUQx" }, "files_to_copy": [], "galleria_theme": "folio", "google_analytics": "", "google_tag_manager": "", "html_language": "fr", "ignore_directories": [ ".??*", "**/.??*" ], "ignore_files": [], "img_extensions": [ ".jpg", ".jpeg", ".png", ".gif", ".JPG", ".JPEG" ], "img_format": null, "img_processor": "ResizeToFit", "img_size": [ 1920, 1920 ], "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", "-strict", "-2" ], "mp4_options_second_pass": null, "orig_dir": "original", "orig_link": false, "output_filename": "index.html", "piwik": { "site_id": 0, "tracker_url": "" }, "plugin_paths": [], "plugins": [ "sigal.plugins.encrypt", "sigal.plugins.extended_caching" ], "rel_link": true, "show_map": true, "site_logo": "", "source": "/home/user/playground/pictures", "theme": "galleria", "thumb_dir": ".thumbnails", "thumb_fit": true, "thumb_fit_centering": [ 0.5, 0.5 ], "thumb_prefix": "", "thumb_size": [ 190, 190 ], "thumb_suffix": "", "thumb_video_delay": "0", "title": "", "use_orig": false, "user_css": null, "video_always_convert": 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" ], "webm_options_second_pass": null, "write_html": true, "zip_gallery": false, "zip_media_format": "resized" } ```
saimn commented 2 years ago

From @dbw9580 in #472:

Videos were not supported by the encrypt plugin, as a critical API (ReadableStream.pipeThrough) for piping decrypted video data into a player was missing in Firefox. Now that Firefox 102 supports the said API, it should be no longer blocked to implement encryption and decryption for videos as well.

saimn commented 2 years ago

@dbw9580 - Good to know, thanks! Do you know what needs to be changed in the encrypt plugin to support this ?

dbw9580 commented 2 years ago

@dbw9580 - Good to know, thanks! Do you know what needs to be changed in the encrypt plugin to support this ?

Currently videos are filtered out from encryption when building the gallery - they no longer have to be. For the decryption side inside the browser, we need to figure out how to enable streaming of the decrypted video, while enabling seeking to an arbitrary timestamp. Whether we should cache the decrypted video on the viewer's side also needs to be looked into.