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

File path gets altered somewhere #16

Closed
prayerslayer opened this issue Oct 18, 2015 · 28 comments
Closed

File path gets altered somewhere #16

prayerslayer opened this issue Oct 18, 2015 · 28 comments

Comments

@prayerslayer
Copy link

Sorry, I'd like to fix this myself, but I'm not proficient in bash scripting.

image

Happens with and without draft mode reliably at this file. It is the second video file expose.sh encounters. Anyways, piccolotto/Desktop/gallery should be /Users/npiccolotto/Desktop/gallery. Same goes for rs/npiccolotto/Desktop/gallery. Not sure if the other errors are caused by the wrong path.

I'm running on OSX 10.10.2. Happens with zsh and bash.

Desktop/gallery » zsh --version
zsh --version
zsh 5.0.6 (x86_64-apple-darwin13.3.0)
Desktop/gallery » bash --version
bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
Copyright (C) 2007 Free Software Foundation, Inc.
@Jack000
Copy link
Owner

Jack000 commented Oct 18, 2015

weird. What does this give you?

find . -type d ! -path ".*/_*" | sort
find . -maxdepth 1 ! -path . ! -path ".*/_*" | sort

@prayerslayer
Copy link
Author

image

Desktop/gallery » find . -type d ! -path ".*/_*" | sort
.
./00 Anreise
./01 Valley of Fire
./02 Death Valley
./03 Red Rock Canyon
./04 Konferenz
./05 Zion Canyon
./06 Grand Canyon
./07 Abreise
Desktop/gallery » find . -maxdepth 1 ! -path . ! -path ".*/_*" | sort
./00 Anreise
./01 Valley of Fire
./02 Death Valley
./03 Red Rock Canyon
./04 Konferenz
./05 Zion Canyon
./06 Grand Canyon
./07 Abreise
Desktop/gallery » 

@Jack000
Copy link
Owner

Jack000 commented Oct 18, 2015

oh right, how about

find "/Users/npiccolotto/Desktop/gallery" -type d ! -path "/Users/npiccolotto/Desktop/gallery*/_*" | sort
find "/Users/npiccolotto/Desktop/gallery/02 Death Valley" -maxdepth 1 ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley" ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley*/_*" | sort

are there any errors for the 00 and 01 galleries?

@prayerslayer
Copy link
Author

Hmmm, nope 😞

Desktop/gallery » find "/Users/npiccolotto/Desktop/gallery" -type d ! -path "/Users/npiccolotto/Desktop/gallery*/_*" | sort
/Users/npiccolotto/Desktop/gallery
/Users/npiccolotto/Desktop/gallery/00 Anreise
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire
/Users/npiccolotto/Desktop/gallery/02 Death Valley
/Users/npiccolotto/Desktop/gallery/03 Red Rock Canyon
/Users/npiccolotto/Desktop/gallery/04 Konferenz
/Users/npiccolotto/Desktop/gallery/05 Zion Canyon
/Users/npiccolotto/Desktop/gallery/06 Grand Canyon
/Users/npiccolotto/Desktop/gallery/07 Abreise

Desktop/gallery » find "/Users/npiccolotto/Desktop/gallery/00 Anreise" -maxdepth 1 ! -path "/Users/npiccolotto/Desktop/gallery/00 Anreise" ! -path "/Users/npiccolotto/Desktop/gallery/00 Anreise*/_*" | sort
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000001.jpg
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000001.md
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000003.jpg
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000003.md
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000012.jpg
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000012.md
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000014.jpg
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000014.md
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000016.jpg
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000016.md
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000030.jpg
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000030.md
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000031.jpg
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000031.md
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000033.jpg
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000033.md
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000041.jpg
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000041.md
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000057.jpg
/Users/npiccolotto/Desktop/gallery/00 Anreise/L1000057.md

Desktop/gallery » find "/Users/npiccolotto/Desktop/gallery/01 Valley of Fire" -maxdepth 1 ! -path "/Users/npiccolotto/Desktop/gallery/01 Valley of Fire" ! -path "/Users/npiccolotto/Desktop/gallery/01 Valley of Fire*/_*" | sort
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000061.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000061.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000070.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000070.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000078.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000078.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000088.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000088.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000102.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000102.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000107.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000107.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000134.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000134.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000139.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000139.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000140.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000140.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000147.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000147.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000151.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000151.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000153.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000153.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000154.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000154.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000165.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000165.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000180.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000180.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000181.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000181.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000201.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000201.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000207.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000207.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000229.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000229.md
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000241.jpg
/Users/npiccolotto/Desktop/gallery/01 Valley of Fire/L1000241.md

Desktop/gallery » find "/Users/npiccolotto/Desktop/gallery/02 Death Valley" -maxdepth 1 ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley" ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley*/_*" | sort
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000243.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000243.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000254.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000254.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000256.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000256.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000257.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000257.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000258.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000258.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.mp4
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000261.mp4
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000263.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000263.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000276.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000276.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.mp4
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000296.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000296.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000308.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000308.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000310.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000310.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000318.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000318.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000319.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000319.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000320.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000320.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000327.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000327.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000333.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000333.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000335.jpg

@prayerslayer
Copy link
Author

It seems to happen after a video file. If I remove files 260 and 261 from gallery 002, it happens at 284 which is after 280 (a video).

Reading files...............................................................................convert: unable to open image '/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg': No such file or directory @ error/blob.c/OpenBlob/2675.

@prayerslayer
Copy link
Author

Not finished yet (encoding right now), but when I remove file 284 from gallery 02 as well, it works. So maybe just "bad" video files? Because I have some more videos…

@Jack000
Copy link
Owner

Jack000 commented Oct 18, 2015

hmm.. the problem is that these paths are wrong, probably not related to the files themselves. Even if the video -> still frame conversion fails, I don't see how it's affecting the next iteration of the loop..

here's a small test program. Save it anywhere and try to execute in the shell:

while read file
do

    echo "$file"

    format=$(identify -format "%m" "$file" 2>/dev/null | tr '[:upper:]' '[:lower:]')

    if [ "$format" != "jpeg" ] && [ "$format" != "png" ] && [ "$format" != "gif" ]
    then

        extension=$(echo "${filename##*.}" | tr '[:upper:]' '[:lower:]')

        # identify command may not be reliable, trust that extensions aren't lying if available
        if [ "$extension" = "jpg" ] || [ "$extension" = "png" ] || [ "$extension" = "gif" ]
        then
            format="$extension"
        else
            # must be a video file
            format="video"
        fi
    fi

    if [ "$format" = "video" ]
    then
        # any errors here?
        ffmpeg -loglevel error -y -i "$file" -vf "select=gte(n\,1)" -vframes 1 -qscale:v 2 test.jpg
    fi


done < <(find "/Users/npiccolotto/Desktop/gallery/02 Death Valley" -maxdepth 1 ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley" ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley*/_*" | sort)

@prayerslayer
Copy link
Author

Heh, there it is again. See iccolotto and s/npiccolotto/....

/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.md: Invalid data found when processing input
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.mp4
At least one output file must be specified
iccolotto/Desktop/gallery/02 Death Valley/L1000261.mp4
iccolotto/Desktop/gallery/02 Death Valley/L1000261.mp4: No such file or directory
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000263.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000263.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000263.md: Invalid data found when processing input
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000276.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000276.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000276.md: Invalid data found when processing input
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.md: Invalid data found when processing input
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.mp4
At least one output file must be specified
s/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg
s/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg: No such file or directory
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.md: Invalid data found when processing input

@Jack000
Copy link
Owner

Jack000 commented Oct 18, 2015

alright, getting closer. How about just:

while read file
do
echo "$file"

done < <(find "/Users/npiccolotto/Desktop/gallery/02 Death Valley" -maxdepth 1 ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley" ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley*/_*" | sort)

@prayerslayer
Copy link
Author

Nope, sorry.

/Users/npiccolotto/Desktop/gallery/02 Death Valley/.DS_Store
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000243.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000243.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000254.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000254.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000256.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000256.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000257.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000257.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000258.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000258.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.mp4
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000261.mp4
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000263.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000263.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000276.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000276.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.mp4
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000296.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000296.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000308.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000308.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000310.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000310.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000318.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000318.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000319.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000319.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000320.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000320.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000327.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000327.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000333.jpg
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000333.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000335.jpg

@Jack000
Copy link
Owner

Jack000 commented Oct 18, 2015

ok, then:

ffmpeg -loglevel error -y -i "/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.mp4" -vf "select=gte(n\,1)" -vframes 1 -qscale:v 2 test.jpg

@prayerslayer
Copy link
Author

Works for all videos (260, 261, 280).

@Jack000
Copy link
Owner

Jack000 commented Oct 18, 2015

hm.. definitely something strange there. try this:

while read file
do

filename=$(basename "$file")
extension=$(echo "${filename##*.}" | tr '[:upper:]' '[:lower:]')

echo "$extension $filename $file"

if [ "$extension" = "mp4" ]
then
    # any errors here?
    ffmpeg -loglevel error -y -i "$file" -vf "select=gte(n\,1)" -vframes 1 -qscale:v 2 test.jpg
fi

echo "$file"

done < <(find "/Users/npiccolotto/Desktop/gallery/02 Death Valley" -maxdepth 1 ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley" ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley*/_*" | sort)

@prayerslayer
Copy link
Author

Thanks for your patience, man! Leading slash gets stripped.

md L1000260.md /Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.md
mp4 L1000260.mp4 /Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.mp4
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000260.mp4
mp4 L1000261.mp4 Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000261.mp4
Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000261.mp4: No such file or directory
Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000261.mp4

/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.md
mp4 L1000280.mp4 /Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.mp4
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000280.mp4
jpg L1000284.jpg Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg
Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg
md L1000284.md /Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.md
/Users/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.md

@Jack000
Copy link
Owner

Jack000 commented Oct 18, 2015

I have patience in abundance : ]

yeah, some of those paths don't have a leading /, I'm not sure what could be causing that.

If you run that test script multiple times, are they always the same ones that are missing the /?
Do you see any pattern in which files are missing the /?

what if you remove the "| sort" from the end of

done < <(find "/Users/npiccolotto/Desktop/gallery/02 Death Valley" -maxdepth 1 ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley" ! -path "/Users/npiccolotto/Desktop/gallery/02 Death Valley*/_*" | sort)

@prayerslayer
Copy link
Author

Aside from the fact that they are all videos I copied from my Android phone via Airdroid it seems pretty much random.

Edit: It seems more like the path name itself is contaminated. Whichever file (content does not matter) starts with the bad path name is determined erroneous by the test script.

@Jack000
Copy link
Owner

Jack000 commented Oct 18, 2015

I think I've replicated this on my mac, but for me it only errors when there are both .webm and .mp4 files in the same directory. (just mp4 or just webm, with the same files, gives no errors)

definitely very strange..

@prayerslayer
Copy link
Author

Hmm, I don't have any webm's. For me the issue seems to be where the filename is in the list. I have one folder where even items are consistently broken.

Consider:

01.mp4
02.mp4
03.mp4
04.mp4

2 and 4 are kaputt. mv 04.mp4 00.mp4:

00.mp4
01.mp4
02.mp4
03.mp4

Now 1 and 3 are kaputt.

@Jack000
Copy link
Owner

Jack000 commented Oct 18, 2015

Order seems to matter on my end too, but it's every 3 files. If I have just a folder of mp4s the error also doesn't occur

@prayerslayer
Copy link
Author

What I also don't understand is why the path is "damaged" only after invoking ffmpeg. If you comment that part out everything looks like it should.

@Jack000
Copy link
Owner

Jack000 commented Oct 19, 2015

yeah I don't get it either. It's not even related to the files, merely invoking the ffmpeg decoder causes the error.

@Jack000
Copy link
Owner

Jack000 commented Oct 19, 2015

ok, so the problem seems to be that ffmpeg is eating the input somehow. Adding -nostdin to the ffmpeg command fixes it on my end.

I pushed a commit that should fix this issue, try it again now : ]

@prayerslayer
Copy link
Author

Hm, not for me 😞

Desktop/gallery » rm -rf _site && expose -d
Draft mode On
Scanning directories.........
Populating nav.........
Reading files..........................................................................s/npiccolotto/Desktop/gallery/02 Death Valley/L1000261.mp4: No such file or directory
.......convert: unable to open image `rs/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg': No such file or directory @ error/blob.c/OpenBlob/2675.
convert: no images defined `txt:-' @ error/convert.c/ConvertImageCommand/3212.
identify: unable to open image `rs/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg': No such file or directory @ error/blob.c/OpenBlob/2675.
identify: unable to open image `rs/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg': No such file or directory @ error/blob.c/OpenBlob/2675.
identify: unable to open image `rs/npiccolotto/Desktop/gallery/02 Death Valley/L1000284.jpg': No such file or directory @ error/blob.c/OpenBlob/2675.
/Users/npiccolotto/Applications/Expose/expose.sh: line 424: [: : integer expression expected
/Users/npiccolotto/Applications/Expose/expose.sh: line 431: res*height/width: division by 0 (error token is "h")

Building HTML............................../Users/npiccolotto/Applications/Expose/expose.sh: line 459: [: : integer expression expected
/Users/npiccolotto/Applications/Expose/expose.sh: line 459: [: : integer expression expected
/Users/npiccolotto/Applications/Expose/expose.sh: line 459: [: : integer expression expected
/Users/npiccolotto/Applications/Expose/expose.sh: line 459: [: : integer expression expected
^C%        

But it does fix our test, running this on 02 gallery (or the whole folder with adjusted maxdepth) does not show bad paths:

#!/bin/bash
dir="/Users/npiccolotto/Desktop/gallery/02 Death Valley"
while read file
do

filename=$(basename "$file")
extension=$(echo "${filename##*.}" | tr '[:upper:]' '[:lower:]')

if [ "$extension" = "mp4" ]
then
    # any errors here?
    ffmpeg -nostdin -loglevel error -y -i "$file" -vframes 1 -qscale:v 2 test.jpg
fi


if [ "$extension" = "jpg" ]
then
    # any errors here?
    identify -format "%wx%h\n" "$file"
fi

echo "$file"

done < <(find "$dir" -maxdepth 1 ! -path "$dir" ! -path "$dir*/_*" | sort)

@Jack000
Copy link
Owner

Jack000 commented Oct 19, 2015

can't reproduce at the moment, so it'll be a bit tough again. But what if you replaced this line:

ffmpeg -loglevel error -nostdin -y -i "$filepath" -vf "select=gte(n\,1)" -vframes 1 -qscale:v 2 "$temppath" < /dev/null

with

echo "$filepath"

does it output a truncated path still? Are there any truncated paths from subsequent commands/errors?

@prayerslayer
Copy link
Author

Okay, I tracked it down to this line (~350):

format=$(identify -format "%m" "$file" 2>/dev/null | tr '[:upper:]' '[:lower:]')

If I comment the format detection out and instead rely on the file extension, it works.

@Jack000
Copy link
Owner

Jack000 commented Oct 19, 2015

thanks for doing the legwork. It's election day here but I'll have a look when I get back.

identify shouldn't have the same issue ffmpeg did, not sure what could be causing this one.

@Jack000
Copy link
Owner

Jack000 commented Oct 21, 2015

we're trusting the file extensions anyways, so I just removed that line

@prayerslayer
Copy link
Author

Yay 🎉

@Jack000 Jack000 closed this as completed Oct 21, 2015
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

2 participants