Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bit plane 10 slices #391

Open
bturkus opened this issue Jul 30, 2019 · 5 comments
Open

bit plane 10 slices #391

bturkus opened this issue Jul 30, 2019 · 5 comments

Comments

@bturkus
Copy link
Contributor

bturkus commented Jul 30, 2019

Hi,

I was wondering if someone could help me figure out how to stream or save an FFplay/FFmpeg command that would mimic the Bit Plane (10 Slices) view in QCTools. I've tried playing around with it, but I keep getting stuck somewhere. The relevant lines of code from QCTools can be found here:

        "Bit Plane (10 slices)",
        0,
        {
            { Args_Type_Toggle,   0,   0,   0,   0, "Rows" },
            { Args_Type_Yuv,      0,   0,   0,   0, "Plane"},
            { Args_Type_Slider,   0,   1,   0,   1, "x offset" },
            { Args_Type_None,     0,   0,   0,   0, nullptr },
            { Args_Type_None,     0,   0,   0,   0, nullptr },
            { Args_Type_None,     0,   0,   0,   0, nullptr },
            { Args_Type_None,     0,   0,   0,   0, nullptr },
        },
        {
            "format=yuv420p10le|yuv422p10le|yuv444p10le|yuv440p10le,split[h1][h2];[h1][h2]hstack,crop=iw/2:ih:${3}:0,\
            split=10[b0][b1][b2][b3][b4][b5][b6][b7][b8][b9];\
            [b0]crop=iw/10:ih:(iw/10)*0:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-1))*pow(2\\,1)[b0c];\
            [b1]crop=iw/10:ih:(iw/10)*1:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-2))*pow(2\\,2)[b1c];\
            [b2]crop=iw/10:ih:(iw/10)*2:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-3))*pow(2\\,3)[b2c];\
            [b3]crop=iw/10:ih:(iw/10)*3:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-4))*pow(2\\,4)[b3c];\
            [b4]crop=iw/10:ih:(iw/10)*4:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-5))*pow(2\\,5)[b4c];\
            [b5]crop=iw/10:ih:(iw/10)*5:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-6))*pow(2\\,6)[b5c];\
            [b6]crop=iw/10:ih:(iw/10)*6:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-7))*pow(2\\,7)[b6c];\
            [b7]crop=iw/10:ih:(iw/10)*7:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-8))*pow(2\\,8)[b7c];\
            [b8]crop=iw/10:ih:(iw/10)*8:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-9))*pow(2\\,9)[b8c];\
            [b9]crop=iw/10:ih:(iw/10)*9:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-10))*pow(2\\,10)[b9c];\
            [b0c][b1c][b2c][b3c][b4c][b5c][b6c][b7c][b8c][b9c]hstack=10,format=yuv444p,drawgrid=w=iw/10:h=ih:t=2:[email protected]",
            "format=yuv420p10le|yuv422p10le|yuv444p10le|yuv440p10le,split[h1][h2];[h1][h2]hstack,crop=iw/2:ih:${3}:0,\
            split=10[b0][b1][b2][b3][b4][b5][b6][b7][b8][b9];\
            [b0]crop=iw:ih/10:0:(ih/10)*0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-1))*pow(2\\,1)[b0c];\
            [b1]crop=iw:ih/10:0:(ih/10)*1,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-2))*pow(2\\,2)[b1c];\
            [b2]crop=iw:ih/10:0:(ih/10)*2,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-3))*pow(2\\,3)[b2c];\
            [b3]crop=iw:ih/10:0:(ih/10)*3,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-4))*pow(2\\,4)[b3c];\
            [b4]crop=iw:ih/10:0:(ih/10)*4,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-5))*pow(2\\,5)[b4c];\
            [b5]crop=iw:ih/10:0:(ih/10)*5,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-6))*pow(2\\,6)[b5c];\
            [b6]crop=iw:ih/10:0:(ih/10)*6,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-7))*pow(2\\,7)[b6c];\
            [b7]crop=iw:ih/10:0:(ih/10)*7,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-8))*pow(2\\,8)[b7c];\
            [b8]crop=iw:ih/10:0:(ih/10)*8,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-9))*pow(2\\,9)[b8c];\
            [b9]crop=iw:ih/10:0:(ih/10)*9,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-10))*pow(2\\,10)[b9c];\
            [b0c][b1c][b2c][b3c][b4c][b5c][b6c][b7c][b8c][b9c]vstack=10,format=yuv444p,drawgrid=w=iw:h=ih/10:t=2:[email protected]",
        },

I tried running this, but it didn't get me there:

ffplay /Users/benjaminturkus/Desktop/truemono.mp4 -vf "format=yuv420p10le|yuv422p10le|yuv444p10le|yuv440p10le,split[h1][h2];[h1][h2]hstack,crop=iw/2:ih:${3}:0,split=10[b0][b1][b2][b3][b4][b5][b6][b7][b8][b9];[b0]crop=iw/10:ih:(iw/10)*0:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-1))*pow(2\\,1)[b0c];[b1]crop=iw/10:ih:(iw/10)*1:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-2))*pow(2\\,2)[b1c];[b2]crop=iw/10:ih:(iw/10)*2:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-3))*pow(2\\,3)[b2c];[b3]crop=iw/10:ih:(iw/10)*3:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-4))*pow(2\\,4)[b3c];[b4]crop=iw/10:ih:(iw/10)*4:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-5))*pow(2\\,5)[b4c];[b5]crop=iw/10:ih:(iw/10)*5:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-6))*pow(2\\,6)[b5c];[b6]crop=iw/10:ih:(iw/10)*6:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-7))*pow(2\\,7)[b6c];[b7]crop=iw/10:ih:(iw/10)*7:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-8))*pow(2\\,8)[b7c];[b8]crop=iw/10:ih:(iw/10)*8:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-9))*pow(2\\,9)[b8c];[b9]crop=iw/10:ih:(iw/10)*9:0,lutyuv=y=512:u=512:v=512:${2}=bitand(val\\,pow(2\\,10-10))*pow(2\\,10)[b9c];[b0c][b1c][b2c][b3c][b4c][b5c][b6c][b7c][b8c][b9c]hstack=10,format=yuv444p,drawgrid=w=iw/10:h=ih:t=2:[email protected]"

If I end up with a workable command, I'd be happy to add to FFmprovisr.

Thanks!

Ben

@privatezero
Copy link
Member

Copying over the twitter response from @dericed here!
ffplay bens_first_day_at_nypl.mkv -vf "format=yuv420p10le|yuv422p10le|yuv444p10le|yuv440p10le,split=10[b0][b1][b2][b3][b4][b5][b6][b7][b8][b9];[b0]crop=iw/10:ih:(iw/10)*0:0,lutyuv=y=bitand(val\,pow(2\,10-1))*pow(2\,1):u=512:v=512[b0c];[b1]crop=iw/10:ih:(iw/10)*1:0,lutyuv=y=bitand(val\,pow(2\,10-2))*pow(2\,2):u=512:v=512[b1c];[b2]crop=iw/10:ih:(iw/10)*2:0,lutyuv=y=bitand(val\,pow(2\,10-3))*pow(2\,3):u=512:v=512[b2c];[b3]crop=iw/10:ih:(iw/10)*3:0,lutyuv=y=bitand(val\,pow(2\,10-4))*pow(2\,4):u=512:v=512[b3c];[b4]crop=iw/10:ih:(iw/10)*4:0,lutyuv=y=bitand(val\,pow(2\,10-5))*pow(2\,5):u=512:v=512[b4c];[b5]crop=iw/10:ih:(iw/10)*5:0,lutyuv=y=bitand(val\,pow(2\,10-6))*pow(2\,6):u=512:v=512[b5c];[b6]crop=iw/10:ih:(iw/10)*6:0,lutyuv=y=bitand(val\,pow(2\,10-7))*pow(2\,7):u=512:v=512[b6c];[b7]crop=iw/10:ih:(iw/10)*7:0,lutyuv=y=bitand(val\,pow(2\,10-8))*pow(2\,8):u=512:v=512[b7c];[b8]crop=iw/10:ih:(iw/10)*8:0,lutyuv=y=bitand(val\,pow(2\,10-9))*pow(2\,9):u=512:v=512[b8c];[b9]crop=iw/10:ih:(iw/10)*9:0,lutyuv=y=bitand(val\,pow(2\,10-10))*pow(2\,10):u=512:v=512[b9c];[b0c][b1c][b2c][b3c][b4c][b5c][b6c][b7c][b8c][b9c]hstack=10,format=yuv444p,drawgrid=w=iw/10:h=ih:t=2:[email protected]"

@bturkus
Copy link
Contributor Author

bturkus commented Jul 30, 2019

thanks! I'll do this I swear!

@todrobbins
Copy link
Contributor

PS: @bturkus congrats on the new jorb!

@richardpl
Copy link

That filter only Y plane, others are ignored...

@kfrn kfrn added the new recipe label Jun 4, 2020
@retokromer
Copy link
Member

thanks! I'll do this I swear!

ping @bturkus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants