1

I am using lf as file manager.

This is my preview.sh

#!/bin/sh image() { geometry="$(($2-2))x$3" chafa "$1" -f sixel -s "$geometry" --animate false } batorcat() { file="$1" shift if command -v bat > /dev/null 2>&1 then bat --color=always --style=plain --pager=never "$file" "$@" else cat "$file" fi } glowormdcat() { file="$1" shift if command -v glow > /dev/null 2>&1 then glow "$file" else mdcat "$file" fi } CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))" case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in *.tgz|*.tar.gz) tar tzf "$1" ;; *.tar.bz2|*.tbz2) tar tjf "$1" ;; *.tar.txz|*.txz) xz --list "$1" ;; *.tar) tar tf "$1" ;; *.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1" ;; *.rar) unrar l "$1" ;; *.md) glowormdcat "$1";; *.7z) 7z l "$1" ;; *.[1-8]) man "$1" | col -b ;; *.o) nm "$1";; *.torrent) transmission-show "$1" ;; *.iso) iso-info --no-header -l "$1" ;; *.odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;; *.doc) catdoc "$1" ;; *.docx) docx2txt "$1" ;; *.xml|*.html) w3m -dump "$1";; *.xls|*.xlsx) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv ;; *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka) exiftool "$1" ;; *.pdf) [ ! -f "${CACHE}.jpg" ] && \ pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" image "${CACHE}.jpg" "$2" "$3" "$4" "$5" ;; *.epub) [ ! -f "$CACHE" ] && \ epub-thumbnailer "$1" "$CACHE" 1024 image "$CACHE" "$2" "$3" "$4" "$5" ;; *.cbz|*.cbr|*.cbt) [ ! -f "$CACHE" ] && \ comicthumb "$1" "$CACHE" 1024 image "$CACHE" "$2" "$3" "$4" "$5" ;; *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) [ ! -f "${CACHE}.jpg" ] && \ ffmpegthumbnailer -i "$1" -o "${CACHE}.jpg" -s 0 -q 5 image "${CACHE}.jpg" "$2" "$3" "$4" "$5" ;; *.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.tiff|*.gif|*.jfif|*.ico) image "$1" "$2" "$3" "$4" "$5" ;; *.svg) [ ! -f "${CACHE}.jpg" ] && \ convert "$1" "${CACHE}.jpg" image "${CACHE}.jpg" "$2" "$3" "$4" "$5" ;; *.ino) batorcat --language=cpp "$1" ;; *) batorcat "$1" ;; esac exit 0 

When I hover over image, I can see preview in right bar. But when I hover on video (ex: .mp4) there is no preview. I have no error logs.

How can I fix my lf setup so I can see video previews?

More information

I am testing it on videos taken on phone. This is exif tool info:

ExifTool Version Number : 13.30 File Name : a.mp4 Directory : . File Size : 321 MB File Modification Date/Time : 2025:08:20 17:03:05+02:00 File Access Date/Time : 2025:08:20 17:03:36+02:00 File Inode Change Date/Time : 2025:08:20 17:03:19+02:00 File Permissions : -rw-r--r-- File Type : MP4 File Type Extension : mp4 MIME Type : video/mp4 Major Brand : MP4 Base Media v1 [IS0 14496-12:2003] Minor Version : 2.0.0 Compatible Brands : isom, iso2, mp41 Media Data Size : 320626529 Media Data Offset : 44 Movie Header Version : 0 Create Date : 2025:08:07 11:25:16 Modify Date : 2025:08:07 11:25:16 Time Scale : 10000 Duration : 0:02:07 Preferred Rate : 1 Preferred Volume : 100.00% Preview Time : 0 s Preview Duration : 0 s Poster Time : 0 s Selection Time : 0 s Selection Duration : 0 s Current Time : 0 s Next Track ID : 5 Android Capture FPS : 30 Android Model : Pixel 6 Android Make : Google Track Header Version : 0 Track Create Date : 2025:08:07 11:25:16 Track Modify Date : 2025:08:07 11:25:16 Track ID : 1 Track Duration : 0:02:07 Track Layer : 0 Track Volume : 0.00% Warning : [minor] The ExtractEmbedded option may find more tags in the media data Balance : 0 Audio Format : mp4a Audio Channels : 2 Audio Bits Per Sample : 16 Audio Sample Rate : 48000 Image Width : 1920 Image Height : 1080 Graphics Mode : srcCopy Op Color : 0 0 0 Compressor ID : hvc1 Source Image Width : 1920 Source Image Height : 1080 X Resolution : 72 Y Resolution : 72 Bit Depth : 24 Pixel Aspect Ratio : 65536:65536 Color Profiles : nclx Color Primaries : BT.709 Transfer Characteristics : BT.709 Matrix Coefficients : BT.709 Video Full Range Flag : Full Video Frame Rate : 29.99 Matrix Structure : 1 0 0 0 1 0 0 0 1 Media Header Version : 0 Media Create Date : 2025:08:07 11:25:16 Media Modify Date : 2025:08:07 11:25:16 Media Time Scale : 90000 Media Duration : 0 s Handler Type : NRT Metadata Handler Description : MetaHandle Meta Format : mett Meta Type : application/microvideo-image-meta Image Size : 1920x1080 Megapixels : 2.1 Avg Bitrate : 20.2 Mbps 

Yes, ffmpegthumbnailer -i "a.mp4" -o "foo.jpg" -s 0 -q 5 produces foo.jpg and it can be previewed in lf.

2
  • Please give a bit more detail: what kind of video file are you testing with? Which of the extensions you have in your config.sh? What happens if you run the relevant command manually? For example ffmpegthumbnailer -i "YOUR_FILE.avi -o "foo.jpg" -s 0 -q 5``? Is the foo.jpg` created? Commented Aug 20 at 9:32
  • @terdon Thank you for comment. I added more info to the post. If you need any more information just ask and I will add it to the post. Commented Aug 20 at 15:09

1 Answer 1

2

Solution was to create cache directory used in creation of video thumbnails.

In my case:

mkdir ~/.cache/lf 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.