[FFmpeg-user] FFmpeg hue can not get same result to canvas huerotate

Steven Liu lingjiujianke at gmail.com
Fri Oct 27 06:55:44 EEST 2017


Hi,

    I test with canvas of javascript(H5) ,test on Chrome, the code is bellow:
---------------------------------
<!DOCTYPE html>
<html>
    <body>

        <video id="video1" controls width="270" autoplay>
            <source src="b.mp4" type='video/mp4'>
        </video>

        <p>get from video refresh every 20ms</p>

        <canvas id="myCanvas" width="270" height="135"
style="border:1px solid #d3d3d3;">
            Your browser does not support the HTML5 canvas tag.
        </canvas>

        <p> picture from ffmpeg use "ffmpeg -y -i
http://bbs.chinaffmpeg.com/b.mp4 -filter_complex "hue=h=90" -vframes 1
ffmpeg.jpg" </p>

        <img src="./ffmpeg.jpg" />

        <script>

var v=document.getElementById("video1");
var c=document.getElementById("myCanvas");
ctx=c.getContext('2d');

v.addEventListener(
        'play',
        function() {
            var i=window.setInterval(
                    function() {
                        ctx.filter = 'hue-rotate(90deg)';
                        ctx.drawImage(v,0,0,270,135);
                    },
                20);
        },
        false
        );
        v.addEventListener('pause',function() {window.clearInterval(i);},false);
        v.addEventListener('ended',function() {clearInterval(i);},false);

        </script>

    </body>
</html>
-------------------------------------

set the hue-rotate to 90.


and set the same deg with ffmpeg:

picture from ffmpeg use "ffmpeg -y -i http://bbs.chinaffmpeg.com/b.mp4
-filter_complex "hue=h=90" -vframes 1 ffmpeg.jpg"

the result is i get similar picture, but the picture get from ffmpeg
is looks like cover by a green color :(

the attechment file is result example, the web link is :
http://bbs.chinaffmpeg.com/a.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: different_result.png
Type: image/png
Size: 136111 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20171027/22bdb817/attachment.png>


More information about the ffmpeg-user mailing list