Page 1 of 1

convert 256 grayscale to non grayscale color: plugin/filter

Posted: 10 Jul 2015 19:08
by bubba12
Greetings;

I thought it would be a neat feature to convert 256 grayscale videos to color

I am going to try to explain algorithms used to convert a grayscale color paletted video to 256 non-grayscale video.

Then I will try to explain how it may work in ffmpeg, I know the Sepia filter is available for vlc media player.

Step 1: get palette from old 256 color video
Step 2a: apply palette to old grayscale (256 color)
Step 2b: it could possibly do this while streaming so you don't have to re-encode the video

in ffmpeg:

get palette from 256 color video that is similar to grayscale: palettegen
Example:
ffmpeg -i HowaWatc1949_edit.mp4 -vf palettegen palette.png

Put palette in video frames?: paletteuse
Example:
ffmpeg -i ffbvideo1.mpg -i palette.png -lavfi paletteuse outputtest.avi
(couldn't get to work)


Note -levfi is for palette.png don't know what it does
references:

High quality gif with ffmpeg:
http://blog.pkh.me/p/21-high-quality-gi ... fmpeg.html

palette gen: https://ffmpeg.org/ffmpeg-filters.html#palettegen
gives example: ffmpeg -i input.mkv -vf palettegen palette.png

Palette use: https://ffmpeg.org/ffmpeg-filters.html#paletteuse
Example given with gif not video: ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif

Re: convert 256 grayscale to non grayscale color: plugin/filter

Posted: 16 Jul 2015 10:35
by Jean-Baptiste Kempf
So, why not doing it? :D

Re: convert 256 grayscale to non grayscale color: plugin/filter

Posted: 24 Jul 2015 23:23
by bubba12
Merci pour ton aide
Still learning, :-) not a programmer by trade, as a hobby
have only taken computer science 1+2 and some javascripting/html, not too familiar with OOP, can't find classes and methods...

Found more info: lavfi is mentioned in the ffmpeg docs: 3.1.2 Complex Filtergraphs; http://ffmpeg.org/ffmpeg.html
and is used for encoding

Will keep trying/learning, this is fun

Re: convert 256 grayscale to non grayscale color: plugin/filter

Posted: 25 Jul 2015 16:49
by Jean-Baptiste Kempf
VLC is C, not OOP :)

Re: convert 256 grayscale to non grayscale color: plugin/filter

Posted: 22 Apr 2016 00:16
by bubba12
VirtualDub has create paletized AVI under tools, will try that. Got it to work with some palettes by using the PsuedoColor filter. I extracted the files to a directory and was able to load the filter from VirtualDub.