Skip to content

Instantly share code, notes, and snippets.

@FWeinb
Last active April 6, 2022 03:07
Show Gist options
  • Save FWeinb/2d51fe63d0f9f5fc4d32d8a420b2c18d to your computer and use it in GitHub Desktop.
Save FWeinb/2d51fe63d0f9f5fc4d32d8a420b2c18d to your computer and use it in GitHub Desktop.
Decoded UDP stream header for LUMIX WiFi streaming.

General Header Structure

[0, 1] Packet Size
[2, 30] Unkown Data
[31] camera metadata size
[32, 46] Unkown Data
[47, 48] Indicate the amount of additinal header data (very likely that these are points of the active af mode)

Let imageOffset be 2 + 30 + [31] and metaDataOffset be 2 + 46 + 6 + ((data[47] << 4) + (data[48] >>> 4)).

[imageOffset, metaDataOffset] is the camera Metadata
[metaDataOffset, END] is an jpeg image  

The output of my current processor can be found here.

Camera Metadata

Assuming that metaData is a view from [imageOffset, metaDataOffset]. The first 19 bytes correspond 1:1 to the cam.cgi?mode=getinfo&type=lens data. (The FZ1000 has a base of 256 for all of these values)

[0, 3] Maximal Aperture

maxAperture = (metaData[0] << 8) + metaData[1]
maxApertureBase = (metaData[2] << 8) + metaData[3]

Caluclate f-stop using sqrt(2^(maxAperture/maxApertureBase))

[4, 7] Minimal Aperture

minAperture = (metaData[4] << 8) + metaData[5]
minApertureBase = (metaData[6] << 8) + metaData[7]

Caluclate f-stop using sqrt(2^(minAperture/minApertureBase))

[8, 11] Current Aperture

aperture = (metaData[8] << 8) + metaData[9]
apertureBase = (metaData[10] << 8) + metaData[11]

Caluclate f-stop using sqrt(2^(aperture/apertureBase))

[12, 15] Unkown Lens Value

unkownValue = (metaData[12] << 8) + metaData[13]
unkownValueBase = (metaData[14] << 8) + metaData[15]

[16, 19] Unkown Lens Value 2

unkownValue2 = (metaData[16] << 8) + metaData[17]
unkownValue2Base = (metaData[18] << 8) + metaData[19]

[20, 22] Shutter Speed

shutterSpeedRaw = (metaData[20] << 8) + metaData[21] // Two's Complement
shutterSpeedBase =  metaData[22]
shutterSpeed = round(shutterSpeedRaw / floor(shutterSpeedBase / 3))
shutterSpeed Meaning  
36 4000
35 3200
34 2500
33 2000
32 1600
31 1300
30 1000
29 800
28 640
27 500
26 400
25 320
24 250
23 200
22 160
21 125
20 100
19 80
18 60
17 50
16 40
15 30
14 25
13 20
12 15
11 13
10 10
9 8
8 6
7 5
6 4
5 3.2
4 2.5
3 2
2 1.6
1 1.3
0 1’’
-1 1.3’’
-2 1.6’’
-3 2’’
-4 2.5’’
-5 3.2’’
-6 4’’
-7 5’’
-8 6’’
-9 8’’
-10 10’’
-11 13’’
-12 15’’
-13 20’’
-14 25’’
-15 30’’
-16 40’’
-17 50’’
-18 60’’

[23, 35] Unknown

[36] Exposure Compensation

  exposureCompensation = metaData[36] // Two's Complement

Ranges from -15 .. 15

[37, 38] Zoom Level

  zoomLevel = (metaData[37] << 8) + metaData[38]

[39, 43] Unknown

[44] Mode

  mode = metaData[44]
Value Meaning
1 P
2 A
3 S
4 M
9 iAutomatic
21 Style Expressiv
22 Style Retro
23 Style High Key
24 Style Low Key
25 Style Sepia
26 Style High Dynamic
27 Style Minuature Effect
28 Style Toy Effect
29 Style Soft Focus
30 Style Dynammic Monochrome
31 Style Impressive Art
32 Style Cross Process
33 Style One Point Color
34 Style Star Filter
60 Film M
101 Style Old Days
102 Style Sunshine
103 Style Bleach Bypass
104 Style Toy Pop
105 Style Fantasy
114 Style Monochrome
110 Style Silky Monochrome
111 Style Rough Monochrome

[45,46] Custom Mode

  customMode = (metaData[45] << 8) + metaData[46]
Value Meaning
256 C1
2560 C2-1
2816 C2-2
3072 C2-3

[47] Picture Style

  pictureStyle = metaData[47]
Value Meaning
1 Standard
2 Vivid
3 Natural
4 Monochrome
5 Scenery
6 Portrait
7 Custom
8 CNED
9 CNEV

[48] // Unkown

[49] Flash Style

  flashStyle = metaData[49]
Value Meaning
1 Off
4 Forced Flash ON
8 Automatic Flash Mode
11 Automatic Flash/Slow Sync
30 Force ON/Red-Eye
31 Slow Sync.
32 Slow Sync/Red-Ey

[50, 52] Unkown

[53] Motion Picture Settings

  motionPitctureSettings = metaData[53]
Value Meaning
1 AVCHD(1080,60p)
2 AVCHD(1080,60i)
3 AVCHD(1080,30p)
8 AVCHD(1080,24p)
14 MP4(1080,30p)
15 MP4(720,30p)
16 MP4(480,30p)
44 MP4(1080,60p)
46 MP4(2160,30p)
68 MP4(2160,24p)

[54] Unkown

[55] Picture Aspect Ratio

  pictureAspectRatio = metaData[55]
Value Meaning
5 4:3
6 3:2
7 16:9
8 1:1

[56] Picture Quality

  pictureAspectRatio = metaData[56]
Value Meaning
1 L
4 M
5 S

[57] Unkown

[58] Picture Quality

  pictureQuality = metaData[58]
Value Meaning
1 Fine
4 Standard
5 RAW+Standard
4 RAW+Fine
5 RAW

[59] Focus Mode

  focusMode = metaData[59]
Value Meaning
1 AFS
2 AFF
3 AFC
5 MF

[60] // Unkown

[61] Autofocus Mode

  focusMode = metaData[61]
Value Meaning
0 Manual
1 1-Area
3 Face/Eye Detection
5 Tracking
7 PinPoint
8 49-Area
11 Custom Multi

[62, 67] // Unkown

[68] Metering Mode

pictureQuality = metaData[68]
Value Meaning
1 Spot
2 Multi Metering
3 Center Weighted

[69] AF/AE Lock

afAeLock = metaData[69]
Value Meaning
0 off
1 on

[70] [73] [75, 77] Unkown

[72] [74] [78] Dial Setting State

  dialSettingState = (metaData[72] << 2) + (metaData[74] << 1) + metaData[78]
Value Meaning
0 None
1 Exposer Correction
2 Shutter Speed
4 Focal Length
6 Shutter Speed & Focal Length

[79] Metering Mode

  meteringMode = metaData[79]
Value Meaning
0 Auto ISO
4 200
5 250
6 320
7 400
8 500
9 640
10 800
11 1000
12 1256
13 1600
14 2000
15 2500
16 3200
17 4000
18 5000
19 6400
20 8000
22 10000
24 128000
29 iISO
30 125

[80] White Balance

  whiteBalance = metaData[80]
Value Meaning
0 AWB
1 Unkown
2 Sun
3 Cloud
4 House Shadow
5 Light Bullb
6 Flash WB
7 Custom 1
8 Custom 2
9 Custom 3
10 Custom 4
11 Custom Kelvin

[81, 83] Unkown

[84] Macro Mode

  macroMode = metaData[84]
Value Meaning
0 Off
1 AF Macro
2 Macro Zoom

[85, 109] Unkown

[110] Burst Mode

  burstMode = metaData[110]
Value Meaning
0 Off
1 On
{
"maxfStop": "8.0",
"minfStop": "2.8",
"fStop": "2.8",
"Shutter Speed": "60",
"Exposure": "0",
"zoom": 25,
"mode": "A",
"customMode": "C2-1",
"Photo Style": "Standard",
"Video Rec Quality": "MP4(1920x1080)60p 28Mbps",
"Aspect Ratio": "3:2",
"Picture Size": "L 20M",
"Quality": "Fine",
"focus_Mode": "AFS",
"AF Mode": "User Defined",
"drive_mode": "Single",
"Metering Mode": "Multi Metering",
"afAeLock": false,
"selected_setting": "Aperture",
"Sensitivity": "i.Auto",
"White Balance": "Auto White Balance",
"Macro Mode": "Off",
"sdAccess": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment