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

hoping to send on windows and decode on another windows #71

Open
denizsincar29 opened this issue May 13, 2023 · 17 comments
Open

hoping to send on windows and decode on another windows #71

denizsincar29 opened this issue May 13, 2023 · 17 comments
Labels
working on it It's on the roadmap

Comments

@denizsincar29
Copy link

Hello. Are there any bindings or utilities to make the encoder and decoder on windows? I am completely inexperienced in c++ and would love to try this awesome library out. Thank you.

@mihaigalos
Copy link

Do you know how to use Docker? Perhaps there's an easy way using it.

@sz3
Copy link
Owner

sz3 commented May 14, 2023

For sending you can use cimbar_js. The easiest way is to save the cimbar.html file from here and open it in your local web browser.

For decoding there's unfortunately not (currently) a good way to do this. It might be possible to rig something up with the cimbar executable using docker (or WSL...), but I haven't done any testing with that approach, and it's likely to feel a bit hack-y regardless.

One eventual goal for this project would be to have a browser-based decoder (just as there's a browser based sender/encoder), but it doesn't exist yet. 😶

edit: incorrectly wrote cimbar_recv instead of cimbar above. The hack that comes to mind is to capture video frames from a native windows app, and pass each saved image -- hopefully stored on ramdisk -- to a dockerized cimbar running in stdin mode.

@denizsincar29
Copy link
Author

i didn't know what is docker untill 2 weeks ago. I was just using docker if there was writen in some instructions. Yes, a browser based decoder would be nice

@mihaigalos
Copy link

Yes, a browser based decoder would be nice

Cool. Would you implement it? :)

@denizsincar29
Copy link
Author

I am a complete beginner at c++. I do what I can, but in this case I wait for a ready solution :). i know that this is not great, but how will i implement a browser based decoder if i can do only cout hello world...

@sz3
Copy link
Owner

sz3 commented May 25, 2023

I am a complete beginner at c++. I do what I can, but in this case I wait for a ready solution :). i know that this is not great, but how will i implement a browser based decoder if i can do only cout hello world...

Ha, don't worry about it. 🙂

I'll likely implement that myself, though I don't know how soon it'll be.

@mihaigalos
Copy link

mihaigalos commented May 25, 2023

I've dockerized a snapshot of libcimbar (commit b0aae78) a while back.
I did it on the run and had some manual steps, hence didn't feel confident contributing it upstream.
If you're very stuck, at least you can try installing Docker and running this:

docker run -it --volume //c/Users/myuser/myfolder:/src mihaigalos/libcimbar

Make sure to adapt the path to mount into docker to the files you want to encode/decode.

Then, inside docker you can type this for help:

cimbar --help

Then just encode a file using:

cimbar --encode -i input.txt -o encoded

And decode using:

cimbar  encoded.png -o .

All credits go to @sz3, source attribution is in the docker under /src-libcimbar.

@denizsincar29
Copy link
Author

hmmm it decodes only static images? but how about data transfer? i mean like animated qrcodes. isn't cimbar made for this?

@sz3
Copy link
Owner

sz3 commented Jun 11, 2023

hmmm it decodes only static images? but how about data transfer? i mean like animated qrcodes. isn't cimbar made for this?

The cimbar executable operates on single or multiple images (it also accepts filenames from stdin, so you can feed it images as they come in). cimbar_recv is a test executable that operates on video streams, but probably won't work in the docker container.

I would definitely categorize it as a hack, but it should be possible to capture camera frames to a series of images, feed them to a long-lived cimbar instance (running in docker) over stdin, and do decodes that way. I'm not sure if that's worth the trouble or not!

@sz3 sz3 added the working on it It's on the roadmap label Aug 15, 2023
@denizsincar29
Copy link
Author

Hello! why we can't just compile cimbar on windows?

@sz3
Copy link
Owner

sz3 commented Sep 27, 2023

Hello! why we can't just compile cimbar on windows?

It's not tested/currently supported, so some work will be necessary to get it to compile/run. But you (or anyone else) is welcome to try it if you want!

I'd guess mingw is probably a safer bet than the MS compiler.

@Anonymous3-a
Copy link

Ok, so I've come up with something that seemed to work for me (with animated barcodes).
First, cimbar --encode <file> -o <prefix>. // Encodes
Second, convert <prefix>_*.png <gifname>.gif // Converts encoded file sequence into animated gif
Third, cimbar_recv -i <gifname>.gif -o . and press Ctrl-C when it says its failing to read from camera (It's written the file already)
Fourth, rename the resulting file to whatever you want.

Disclaimer: I am on Linux, so I don't know if it works on windows, but with docker seems like it might work.
Also, for compiling for windows, maybe try cygwin?

@wisplite
Copy link

wisplite commented Sep 8, 2024

What is the progress on a browser-based decoder? I'm making an app in react-native, which needs to transfer data to other devices wirelessly without using WiFi. This project seems absolutely perfect for this use.

I'd also be willing to contribute if needed. What needs to be done for decoding to work on the web?

@sz3
Copy link
Owner

sz3 commented Sep 9, 2024

Progress is ... not much yet.

I'd also be willing to contribute if needed. What needs to be done for decoding to work on the web?

Quite a bit. My plan would/will be something like:

  • simple (non-cimbar) app to validate the best approach for current html5 apis + js + wasm.
    • specifically, we (probably) want a series of rgb byte buffers we can forward on to our wasm code -- vs trying some gross wasm-side camera api interaction
    • there are apis to evaluate. Supporting more browsers would be better than less, but probably not at the expense of performance. The realtime image capture html5 api situation a few years ago (~2021) was pretty discouraging, but there seem to be some better options now:
    • after picking the right (or at least "good enough") api, I'd incorporate a new "cimbar_js_decoder" demo app into the source tree (it wouldn't do any decoding. Maybe just flip some rgb values to let us know it's working and report frame counts)
  • add web workers to this new decoder webapp -- we're gonna need multithreading. (note: the encoder might benefit from this as well?)
  • various libcimbar code changes follow:
    • refactor various things in the decoder to allow it to compile against the wasm target + make it actually work
    • optimize the decoder for wasm to whatever extent is possible. May involve GPU stuff.
    • write a wrapper/version of the decoder "sink" thread (what the code calls the "fountain_decoder_sink") that works with web workers. I have no idea how annoying this will be, but it does imply some shared cross-thread state.
      • I suppose it's possible if GPU optimization magic is good enough that we could get away with a single-thread decoder (it'd still be a background web worker thread). I'm skeptical about that though.

If someone does want to dig into the technology side -- or better yet, already has and can just tell me what the optimal answer is ( 🙂 ) that'd be the logical place to start.

(edit: apologies for all the edits, I'm done now 😶 )

@wisplite
Copy link

wisplite commented Sep 9, 2024

Is there any reason the MediaStream Recording API/WebRTC API wouldn't work? That's the recommended method for recording and streaming video and audio on the web.

https://developer.mozilla.org/en-US/docs/Web/API/MediaStream_Recording_API

As for the lower-level C++ stuff, I'm much less familiar with that than I am with web development, but I'll still try and help with that wherever I can.

@sz3
Copy link
Owner

sz3 commented Sep 9, 2024

Is there any reason the MediaStream Recording API/WebRTC API wouldn't work? That's the recommended method for recording and streaming video and audio on the web.

https://developer.mozilla.org/en-US/docs/Web/API/MediaStream_Recording_API

As for the lower-level C++ stuff, I'm much less familiar with that than I am with web development, but I'll still try and help with that wherever I can.

MediaStream is another option to add to the list above. All of these seem like they should work, but past experience says one or more of them won't perform well enough to use. Only one way to find out though...

@CrisprHarrison
Copy link

There's another project about file transition via QR Code: qifi-dev/qrs, it seems work slower than this one in maximum about 30kB/s on iPhone.
But the demo can decode the file on web. The decode efficiency on web depend on device: iPhone avg 15-19 fps, android and PC 5-12 fps, with great heat on device. So I think app would be a better solution.
BTW, the web can provide more information like File metadata and speed/progress. And also a modern appearance for that😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
working on it It's on the roadmap
Projects
None yet
Development

No branches or pull requests

6 participants