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

Video imports fail #1218

Closed
anoteng opened this issue Feb 8, 2022 · 7 comments · Fixed by #1219
Closed

Video imports fail #1218

anoteng opened this issue Feb 8, 2022 · 7 comments · Fixed by #1219
Labels
bug Something isn't working High Priority High priority issues

Comments

@anoteng
Copy link

anoteng commented Feb 8, 2022

Detailed description of the problem [REQUIRED]

I'm using the import from server function to import my photo collection previously hosted on Synology PhotoStation. First import of the whole collection failed, but after splitting it up into yearly batches photo import works just fine. My problem is that a lot of these folders include video files. Most of these videos are of supported file formats, but they fail import.
I see a couple of previous references to the issue here: https://www.giters.com/LycheeOrg/Lychee-v3/issues/326 and here: LycheeOrg/Lychee-v3#156 but they are both reported for Lychee v3
Looks like the import function is trying to treat the video files as images.

Steps to reproduce the issue

Steps to reproduce the behavior:

  1. import folders containing videos
  2. See videos failing to import
  3. Log file says: Photo type not supported: ..MP4

Screenshots
If applicable, add screenshots to help explain your problem.

Output of the diagnostics [REQUIRED]

Diagnostics
-------
Warning: '/opt/lychee/public/dist/user.css' does not exist or has insufficient read/write privileges.
Warning: Dropbox import not working. dropbox_key is empty.
Warning: Default timezone not properly set; you might experience strange results when importing photos without explicit EXIF timezone



System Information
--------------
Lychee Version (git):            master (8c6b200) - Data not in Cache
DB Version:                      4.5.0

composer install:                --no-dev
APP_ENV:                         production
APP_DEBUG:                       false

System:                          Linux
PHP Version:                     8.1
PHP User agent:                  Lychee/4 (https://lycheeorg.github.io/)
Timezone:                        UTC
Max uploaded file size:          500M
Max post size:                   500M
Max execution time:              200
MySQL Version:                   8.0.28-0ubuntu0.20.04.3

Imagick:                         1
Imagick Active:                  1
Imagick Version:                 1690
GD Version:                      2.3.0



Config Information
--------------
version:                         040500
check_for_updates:               0
sorting_Photos_col:              taken_at
sorting_Photos_order:            ASC
sorting_Albums_col:              max_taken_at
sorting_Albums_order:            ASC
imagick:                         1
skip_duplicates:                 0
small_max_width:                 0
small_max_height:                360
medium_max_width:                1920
medium_max_height:               1080
lang:                            nb-no
layout:                          1
image_overlay_type:              desc
default_license:                 none
compression_quality:             90
full_photo:                      1
delete_imported:                 0
Mod_Frame:                       1
Mod_Frame_refresh:               30
thumb_2x:                        1
small_2x:                        1
medium_2x:                       1
landing_page_enable:             0
landing_owner:                   Lene Noteng
landing_title:                   Lene Noteng
landing_subtitle:                Bilder
landing_facebook:                https://www.facebook.com/JohnSmith
landing_flickr:                  https://www.flickr.com/JohnSmith
landing_twitter:                 https://www.twitter.com/JohnSmith
landing_instagram:               https://instagram.com/JohnSmith
landing_youtube:                 https://www.youtube.com/JohnSmith
landing_background:              dist/cat.jpg
site_title:                      Lychee v4
site_copyright_enable:           1
site_copyright_begin:            2004
site_copyright_end:              2022
additional_footer_text:          
display_social_in_gallery:       0
public_search:                   0
SL_enable:                       0
SL_for_admin:                    0
public_recent:                   0
recent_age:                      1
public_starred:                  0
downloadable:                    0
photos_wraparound:               1
map_display:                     0
zip64:                           1
map_display_public:              0
map_provider:                    Wikimedia
force_32bit_ids:                 0
map_include_subalbums:           0
update_check_every_days:         3
has_exiftool:                    0
share_button_visible:            0
import_via_symlink:              0
has_ffmpeg:                      1
location_decoding:               0
location_decoding_timeout:       30
location_show:                   1
location_show_public:            0
rss_enable:                      0
rss_recent_days:                 7
rss_max_items:                   100
prefer_available_xmp_metadata:   0
editor_enabled:                  1
lossless_optimization:           0
swipe_tolerance_x:               150
swipe_tolerance_y:               250
local_takestamp_video_formats:   .avi|.mov
log_max_num_line:                1000
unlock_password_photos_with_url_param: 0
nsfw_visible:                    1
nsfw_blur:                       0
nsfw_warning:                    0
nsfw_warning_admin:              0
map_display_direction:           1
album_subtitle_type:             oldstyle
upload_processing_limit:         4
public_photos_hidden:            1
new_photos_notification:         0
legacy_id_redirection:           1

Browser and system

Server: Ubuntu 20.04 with packported PHP8.1
Storage: Synology NAS mounted via NFS
Browser: Google Chomre

@anoteng
Copy link
Author

anoteng commented Feb 8, 2022

I figured I'd try to help and forked the source. Located the part where Lychee should check if it's dealing with a video or a photo (app/Actions/Photo/Create.php line 259), but I'm afraid fixing it is a bit above my skill level.
Edit: app/Actions/Import/Exec.php line 259

@nagmat84
Copy link
Collaborator

nagmat84 commented Feb 8, 2022

No problem. Right now I am on my lunch break from my (official) work. I will look into that this evening.

Located the part where Lychee should check if it's dealing with a video or a photo (app/Actions/Photo/Create.php line 259)

Ahm, there is no line 259 in that file?

Anyway there are quick tests you could do. I don't know if they are purposeful, because I cannot check with the source code right now (I am typing on my mobile) and I do not know the code by heart.

a) I noticed that your file extension is in capital letters ..MP4 and starts with two dots. Could you check what happens if the file extension is in small letters and if the last character before is the file extension is not another dot? I.e. the file should not be named my-video..MP4. Maybe this is just a trivial parsing error of the file extension.

b) If you are brave and have a full backup of you data, you could try the experimental branch consistent_json_api. But beware, the branch is still under on-going, heavy development, not reviewed yet and absolutely not suitable for productive work. In particular many features (lile adding new users) won't work. However, file uploading should work and the main achievement of the branch is proper error reporting to the client. In particular, you should get a much more precise message of what has failed.

This might be helpful for further debugging. I will read your answer this evening.

@anoteng
Copy link
Author

anoteng commented Feb 8, 2022

Sorry, wrong file, the correct source file is: app/Actions/Import/Exec.php

No, the file I tried to import did not contain a double dot nor a capital file extension. I'll see if I can find a whole log line next time it tries to import a video.

I'm still importing a huge photo library (wife takes a LOT of photos...). I can see if I can set up a separate test environment with source from experimental branch once the import is done.

@anoteng
Copy link
Author

anoteng commented Feb 8, 2022

Looked again, seems like that file had a capital file extension. Here's a full log entry:
2022-02-08 12:20:14 -- error -- App\Actions\Import\Exec::do -- 286 -- Could not import file (/mnt/nas/lene_bilder/2014/08-august/20140821_143213.mp4): Photo type not supported!
2022-02-08 12:20:14 -- error -- App\Actions\Photo\Extensions\Checks::file_kind -- 113 -- Photo type not supported: ..mp4

@kamil4 kamil4 added bug Something isn't working High Priority High priority issues labels Feb 8, 2022
@kamil4
Copy link
Contributor

kamil4 commented Feb 8, 2022

Confirmed. Import fails completely, whereas upload fails to generate a thumbnail. Looks like a regression from a recent commit (maybe #1203 ?).

I can't work on it at the moment but if @nagmat84 won't get to it tonight, I will try later today.

@kamil4
Copy link
Contributor

kamil4 commented Feb 8, 2022

@anoteng You can try the fix from branch fix-1218.

@anoteng
Copy link
Author

anoteng commented Feb 8, 2022

That was an impressively quick fix!. Seeing this in the log now:
2022-02-08 19:16:41 -- notice -- App\Image\SizeVariantDefaultFactory::createTmpPathForReference -- 182 -- Saving JPG of raw/video file to /tmp/lychee1I0L43
Can confirm that videos import fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working High Priority High priority issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants