Git Product home page Git Product logo

Comments (8)

filiptc avatar filiptc commented on June 8, 2024 1

So I've been making myself smart and it seems that mjpeg stream frames do not have Huffman Table information (DHT). This was taken out and standardized for bandwidth optimization. The standardized DHT segment (where the starting ffc4 is the DHT marker) needs to be inserted before the 0xFFDA marker in order to be a universally valid JPEG:

ffc4 01a2 0000 0105 0101 0101 0101 0000
0000 0000 0000 0102 0304 0506 0708 090a
0b01 0003 0101 0101 0101 0101 0100 0000
0000 0001 0203 0405 0607 0809 0a0b 1000
0201 0303 0204 0305 0504 0400 0001 7d01
0203 0004 1105 1221 3141 0613 5161 0722
7114 3281 91a1 0823 42b1 c115 52d1 f024
3362 7282 090a 1617 1819 1a25 2627 2829
2a34 3536 3738 393a 4344 4546 4748 494a
5354 5556 5758 595a 6364 6566 6768 696a
7374 7576 7778 797a 8384 8586 8788 898a
9293 9495 9697 9899 9aa2 a3a4 a5a6 a7a8
a9aa b2b3 b4b5 b6b7 b8b9 bac2 c3c4 c5c6
c7c8 c9ca d2d3 d4d5 d6d7 d8d9 dae1 e2e3
e4e5 e6e7 e8e9 eaf1 f2f3 f4f5 f6f7 f8f9
fa11 0002 0102 0404 0304 0705 0404 0001
0277 0001 0203 1104 0521 3106 1241 5107
6171 1322 3281 0814 4291 a1b1 c109 2333
52f0 1562 72d1 0a16 2434 e125 f117 1819
1a26 2728 292a 3536 3738 393a 4344 4546
4748 494a 5354 5556 5758 595a 6364 6566
6768 696a 7374 7576 7778 797a 8283 8485
8687 8889 8a92 9394 9596 9798 999a a2a3
a4a5 a6a7 a8a9 aab2 b3b4 b5b6 b7b8 b9ba
c2c3 c4c5 c6c7 c8c9 cad2 d3d4 d5d6 d7d8
d9da e2e3 e4e5 e6e7 e8e9 eaf2 f3f4 f5f6
f7f8 f9fa

The browsers seem to parse the jpeg type header (AVI1) and do the DHT loading internally.

from webcam.

blackjack avatar blackjack commented on June 8, 2024

Unfortunately I cannot reproduce the issue on my hardware which complicates things a bit. Can you provide details on your platform? Does any other software properly work with your camera?
Also, I think the frame binary data posted somewhere could help as well.

from webcam.

filiptc avatar filiptc commented on June 8, 2024

When redirecting the mjpeg stream to the browser, it reproduces normally. The webcam is Logitech Orbit AF, running on ARM (Raspbian on a Raspberry Pi 3). The code is currently in filiptc/gorbit (https://github.com/filiptc/gorbit/blob/master/image/overlay.go).

from webcam.

filiptc avatar filiptc commented on June 8, 2024

Here's the saved binary: frame

from webcam.

filiptc avatar filiptc commented on June 8, 2024

Oddly enough, browsers seem not to care about Huffman tables... If you download the file and try to open it in a desktop app it will throw the Huffman table error.

from webcam.

filiptc avatar filiptc commented on June 8, 2024

Here's the function that adds DHT and creates a standard JPEG file: https://github.com/filiptc/gorbit/blob/fa87ff39b68a6706306f34c318e0b9a5a3c97110/image/overlay.go#L37-L40

from webcam.

blackjack avatar blackjack commented on June 8, 2024

I'm glad that you've managed to figure out and solve the problem.
p.s. Nice rabbit :)

from webcam.

0x3333 avatar 0x3333 commented on June 8, 2024

Here's the function that adds DHT and creates a standard JPEG file: https://github.com/filiptc/gorbit/blob/fa87ff39b68a6706306f34c318e0b9a5a3c97110/image/overlay.go#L37-L40

Damn! My microsoft HD 3000 camera has the same "optimization", your code fixed it! Thanks

from webcam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.