Simple-Gallery icon indicating copy to clipboard operation
Simple-Gallery copied to clipboard

AV1 support

Open TyraVex opened this issue 2 years ago • 13 comments

TyraVex avatar Jun 01 '22 22:06 TyraVex

do other galleries play them?

tibbi avatar Jun 01 '22 22:06 tibbi

do other galleries play them?

The photo can't be opened anywhere (it was encoded with avifenc + aomenc) The video can only be played by google photos

Edit: here are the commands I use

avifenc -c aom -j "$threads" -d 8 --min "$avifMinQuality" --max "$avifMaxQuality" -s "$avifQuality" "${initNames[i]}" "$finalName-ffmpeg.avif"

nice ffmpeg -y -i "${initNames[i]}" -strict -1 -loglevel error $args \
  -f yuv4mpegpipe - | aomenc - --passes=2 --pass=1 \
  --cpu-used="$av1Quality" --threads="$threads" \
  --end-usage=q --cq-level="$crf" --bit-depth=8 \
  --enable-fwd-kf=1 --kf-max-dist=300 --kf-min-dist=12 \
  --tile-columns=0 --tile-rows=0 --sb-size=64 \
  --lag-in-frames=48 \
  --arnr-strength=2 --arnr-maxframes=3 \
  --aq-mode=0 --deltaq-mode=1 --enable-qm=1 \
  --tune=psnr --tune-content=default \
  --fpf="/tmp/pass-$random" -o NUL && \
nice ffmpeg "$overwrite" -i "${initNames[i]}" -strict -1 -loglevel error $args \
  -f yuv4mpegpipe - | aomenc - --passes=2 --pass=2 \
  --cpu-used="$av1Quality" --threads="$threads" \
  --end-usage=q --cq-level="$crf" --bit-depth=8 \
  --enable-fwd-kf=1 --kf-max-dist=300 --kf-min-dist=12 \
  --tile-columns=0 --tile-rows=0 --sb-size=64 \
  --lag-in-frames=48 \
  --arnr-strength=2 --arnr-maxframes=3 \
  --aq-mode=0 --deltaq-mode=1 --enable-qm=1 \
  --tune=psnr --tune-content=default \
  rc--fpf="/tmp/pass-$random" -o "$finalName-video.mkv" && \
ffmpeg "$overwrite" -loglevel warning -i "$finalName-video.mkv" -i "${initNames[i]}" -map 0:v -c:v copy -map 1:a? -c:a libopus -b:a "$audioBitrate"k -map 0:s? -max_interleave_delta 0 "$finalName-ffmpeg.mkv" && \

TyraVex avatar Jun 01 '22 22:06 TyraVex

I ran the following command and got 420.avif to display correctly and 422.avif to display completely black.

  • avifenc --yuv 420 src.png 420.avif
  • avifenc --yuv 422 src.png 422.avif

ffmpeg -i 420.avif says compatible_brands is "avifmif1miafMA1B", whereas ffmpeg -i 422.avif shows "avifmif1miaf"

Both 420 and 422 can be displayed correctly in Firefox

420_422_avif.zip

sceneq avatar Sep 05 '23 08:09 sceneq

Not sure how relevant this is, but I noticed that smaller photos (in resolution terms, eg: 2000x1500) tend to display fine but bigger (eg: 4000x3000) ones fail, so maybe this whole issue is somehow a memory limit problem?

jlHertel avatar Sep 14 '23 19:09 jlHertel

same request here, tried to open a jpeg photo converted to avif using imagemagick (convert photo.jpg photo.avif) and it don't open, since /e/os (android 12) gallery don't open it either, i'm not sure if it is a /e/os missing or a issue of simple gallery....

jlmxyz avatar Oct 08 '23 20:10 jlmxyz

Same request, you can use Glide on Java which support avif easily, or use libavif on C directly. The avif files are much smaller than jpg, so I convert almost all my photos to avif. They can be opened on PC by XNView MP, but on Android, there are few apps support avif.

I tried to make one by Qt on Android, but it was too difficult to let it support avif...

Mario-Hero avatar Oct 25 '23 08:10 Mario-Hero

Ok, I solved it... I simply added the dependency "com.github.bumptech.glide:avif-integration:$latestversion" and built it, then it worked!!!!!!!!!!! Now it can show avif pictures on my Huawei Nova7

Mario-Hero avatar Oct 25 '23 13:10 Mario-Hero

nice! did you tested with images created from photos using imagemagick "convert" tool? I noticed that some sample avif does display fine, but others not, in particular none of my photos converted using imagemagick...

hope this will be in next simple gallery release

Le 25 octobre 2023 15:45:17 GMT+02:00, Mario Hero @.***> a écrit :

Ok, I solved it... I simply added the dependency "com.github.bumptech.glide:avif-integration:$latestversion" and built it, then it worked!!!!!!!!!!! Now it can show avif pictures on my Huawei Nova7

-- Reply to this email directly or view it on GitHub: https://github.com/SimpleMobileTools/Simple-Gallery/issues/2496#issuecomment-1779312467 You are receiving this because you commented.

Message ID: @.***>

jlmxyz avatar Oct 25 '23 17:10 jlmxyz

I uploaded the apk, you can try it at https://github.com/Mario-Hero/Simple-Gallery-AVIF/releases/tag/Publish

nice! did you tested with images created from photos using imagemagick "convert" tool? I noticed that some sample avif does display fine, but others not, in particular none of my photos converted using imagemagick... hope this will be in next simple gallery release Le 25 octobre 2023 15:45:17 GMT+02:00, Mario Hero @.> a écrit : Ok, I solved it... I simply added the dependency "com.github.bumptech.glide:avif-integration:$latestversion" and built it, then it worked!!!!!!!!!!! Now it can show avif pictures on my Huawei Nova7 -- Reply to this email directly or view it on GitHub: #2496 (comment) You are receiving this because you commented. Message ID: @.>

Mario-Hero avatar Oct 26 '23 00:10 Mario-Hero

hi, I made some testing, seems to works great! hope it'll be in next release! best regards

Le 26 octobre 2023 02:23:26 GMT+02:00, Mario Hero @.***> a écrit :

I uploaded the apk, you can try it at https://github.com/Mario-Hero/Simple-Gallery-AVIF/releases/tag/Publish

nice! did you tested with images created from photos using imagemagick "convert" tool? I noticed that some sample avif does display fine, but others not, in particular none of my photos converted using imagemagick... hope this will be in next simple gallery release Le 25 octobre 2023 15:45:17 GMT+02:00, Mario Hero @.> a écrit : Ok, I solved it... I simply added the dependency "com.github.bumptech.glide:avif-integration:$latestversion" and built it, then it worked!!!!!!!!!!! Now it can show avif pictures on my Huawei Nova7 -- Reply to this email directly or view it on GitHub: #2496 (comment) You are receiving this because you commented. Message ID: @.>

-- Reply to this email directly or view it on GitHub: https://github.com/SimpleMobileTools/Simple-Gallery/issues/2496#issuecomment-1780232868 You are receiving this because you commented.

Message ID: @.***>

jlmxyz avatar Nov 01 '23 17:11 jlmxyz

in fact the issue with portrait one is a bug in libheif 1.15.2 used by imagemagick, it encode the data swaping height and width.... files created by libavif's avifenc tools display fine! 🎉

Le 1 novembre 2023 18:17:48 GMT+01:00, jlmxyz @.***> a écrit :

seems that there is some issues with the portrait ones, they display fine on pc but tried to be displayed as landscape on simple-gallery-avif

here is an image sample

Le 01/11/2023 à 18:08, jlmxyz a écrit :

hi, I made some testing, seems to works great! hope it'll be in next release! best regards

Le 26 octobre 2023 02:23:26 GMT+02:00, Mario Hero @.***> a écrit :

I uploaded the apk, you can try it at
https://github.com/Mario-Hero/Simple-Gallery-AVIF/releases/tag/Publish

    nice! did you tested with images created from photos using
    imagemagick "convert" tool? I noticed that some sample avif
    does display fine, but others not, in particular none of my
    photos converted using imagemagick... hope this will be in
    next simple gallery release Le 25 octobre 2023 15:45:17
    GMT+02:00, Mario Hero /*@*/./*> a écrit :
    … <#>
    Ok, I solved it... I simply added the dependency
    "com.github.bumptech.glide:avif-integration:$latestversion"
    and built it, then it worked!!!!!!!!!!! Now it can show avif
    pictures on my Huawei Nova7 -- Reply to this email directly or
    view it on GitHub: #2496 (comment)
    <https://github.com/SimpleMobileTools/Simple-Gallery/issues/2496#issuecomment-1779312467>
    You are receiving this because you commented. Message ID:
    /*@*/.*/>

—
Reply to this email directly, view it on GitHub
<https://github.com/SimpleMobileTools/Simple-Gallery/issues/2496#issuecomment-1780232868>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJUDLRA6GWHBLY2HPUEXMELYBGUP5AVCNFSM5XS6MY42U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZYGAZDGMRYGY4A>.
You are receiving this because you commented.Message ID:
***@***.***>

jlmxyz avatar Nov 07 '23 13:11 jlmxyz

hey @tibbi Any chance we can make the above suggested change of adding the dependency com.github.bumptech.glide:avif-integration:$latestversion and making a new release?

Thanks in advance

jlHertel avatar Nov 14 '23 07:11 jlHertel

hey @tibbi I add the avif dependency and make a pull request, it works fine. Check it at here. The apk is here.

Thanks!

Mario-Hero avatar Nov 14 '23 09:11 Mario-Hero

@tibbi Bumping this once again, in the hope you manage to get some free time in the holidays to take a look on the suggested change.

jlHertel avatar Dec 31 '23 17:12 jlHertel