thimc / lfimg

Image preview support for lf (list files) using Überzug
GNU General Public License v3.0
252 stars 45 forks source link

Audio preview #31

Open nonetrix opened 2 years ago

nonetrix commented 2 years ago

It would be neat if audio files showed the waves like so audio

thimc commented 2 years ago

From what I've read in the documentation displaying real time previews is not possible in lf.

Sure you could always generate a static preview but then again it all comes down to personal preference.

Feel free to submit a patch if you think it's worth looking in to.

xezwary commented 2 years ago

You can use FFmpeg for this https://trac.ffmpeg.org/wiki/Waveform

    *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka)
        [ ! -f "${CACHE}.jpg" ] && \
            ffmpeg -i "$1" -f lavfi -i color=c=black:s=640x320 -filter_complex "[0:a]aformat=channel_layouts=mono,showwavespic=s=640x320:colors=white[fg];[1:v][fg]overlay=format=auto" -frames:v 1 "$CACHE.jpg"
        image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
        ;;

Looks pretty nice when used with both chafa and exiftool Screenshot_2022-05-25_01-16-26

nonetrix commented 2 years ago

I'll attempt to make a commit seems the dev has been slightly inactive not that it is abandoned :P

nonetrix commented 2 years ago

Works great honestly should have just looked into doing this would have figured this out myself most likely Screenshot from 2022-05-24 21-43-38

thimc commented 2 years ago

I'll attempt to make a commit seems the dev has been slightly inactive not that it is abandoned :P

Terribly sorry, I don't use Linux these days which means I'm not able to test each and every diff. I'm also thinking that a pull request doesn't necessarily need to be merged, the way I see it is that upstream should contain everything to get you going, and depending on what functionality you need you pull the pull requests and merge them. (think suckless)