convert 256 grayscale to non grayscale color: plugin/filter
Posted: 10 Jul 2015 19:08
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
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