Skip to content

Instantly share code, notes, and snippets.

Mateusz Starzak matiaspl

  • @Tellyo & Lodz University of Technology
  • Lodz, Poland
Block or report user

Report or block matiaspl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@matiaspl
matiaspl / README_tronxy.md
Last active Feb 21, 2020
Tronxy specific gists
View README_tronxy.md

All Tronxy stuff goes here

cprsImage.py - algorithm for creating previews displayed on the Tronxy LCD using M4010 GCODE commands (as seen in the Tronxy Slicer) - base for a Cura postprocessing script/plugin. The function is executed from Tronxys' CuraEngineBackend like this:

if self._screenshotImages and Preferences.getInstance().getValue('cura/enablePreview'):
            startX, startY, endX, endY = cprsImage.detectImageValidRange(self._screenshotImages[1])
            self._scene.gcode_list.insert(0, cprsImage.genImageGcode(self._screenshotImages[0], startX, startY, endX, endY))
View gist:8b1880456d10d582677aadb474d743b6

mpv --hwdec="no" --lavfi-complex="[aid1]asplit=3[sv][eb][av];[sv]showvolume=b=4:w=720:h=68[sv-v];[eb]ebur128=video=1:size=720x540:meter=18[eb-v][ao];[av]avectorscope=s=720x540:zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7[av-v];[sv-v][eb-v][av-v]vstack=3[1c];[vid1]split=4[v][wf][wfc][vs];[wf]waveform=m=1:d=0:r=0:c=7[wf-vus];[wf-vus][v]scale2ref=iw:1220-ih[wf-va][sig];[wf-va]setsar=1[wf-v];[wfc]waveform=m=0:d=0:r=0:c=7,scale=610x610,setsar=1[wfc-v];[vs]vectorscope=m=color3:g=color,scale=610x610,setsar=1[vs-v];[sig][wf-v]vstack[2c];[wfc-v][vs-v]vstack[3c];[1c][2c][3c]hstack=3,scale=1280:-1[vo]" rtmp://server/app/key

@matiaspl
matiaspl / realtek_vid_pid_mac_hacking.md
Last active Aug 30, 2019
Replace VID, PID, MAC and channel plan on Realtek USB wifi dongles (e.g. 8811AU)
View realtek_vid_pid_mac_hacking.md

Why would you even want to do that?

Well, there are some vendor locked dongles out there (I'm looking at you Panasonic!) that use regular off-the-shelf chips but cost a lot of money and not $5 that they're really worth. E.g. there's the AJ-WM50E dual band AC dongle (sold for 160 USD) that you should use with AG-UX180 camera to get wifi CCU running.

I happen to have one such dongle, couple of summer holiday nights and family far, far away. Why not do some hacking then?

The camera is - as far as I can tell - running Linux or a similar system. If so, it has a limited set of tools to get to know what's getting connected to it.

Ultimate goal

Make the not-so-Panasonic dongle resemble the Panasonic one as much as possible, so that the camera just enables it thinking it's legit.

@matiaspl
matiaspl / ffmpeg_bmd_videotoolbox.md
Last active Aug 22, 2019
Stream RTMP with FFMPEG + BMD Ultrastudio Recorder on OSX (hardware accelerated encoding)
View ffmpeg_bmd_videotoolbox.md

You might ask why would anyone do it in the first place? Well, OBS is the only reasonable free tool for OSX for streaming but it has a flaw which makes it impossible to stream 1080p50/p60 on my i5 MacBook Pro. It works if you disable preview, but then if you can't see the video there's no reason for using OBS ;)

You need ffmpeg-dl from ffmpegdecklink brew package by AMIA Open Source (brew install ffmpegdecklink). It's worth noting that unlike brew's regular ffmpeg this one allows building ffmpeg with additional libraries (e.g. brew install ffmpegdecklink -with-srt in case you need SRT).

/usr/local/opt/ffmpegdecklink/bin/ffmpeg-dl -f decklink -i 'UltraStudio Mini Recorder' -video_input hdmi -format_code Hi50 -audio_input embedded -channels 2 -vf yadif=1 -c:v h264_videotoolbox -profile:v main -b:v 6M -pix_fmt yuv420p -color_range 1 -coder cabac -c:a aac_at -b:a 192k -f flv rtmp://your_server/app/key

What this does is capture 1080i50 signal from HDMI input (use *-vi

View Blackmagic Videohub Smart Control - broken PoE ethernet fix
This device has a design flaw which - if you're not careful enough - might lead to ethertnet socket popping out of the board and taking solder pads along on a bad day. And on a good day you might end up with partially working socket because only a smaller part of the socket will lose contact with the board - power but no link, link but no power, etc.
The bad thing is that the PCB is a multi layered one and you can't really see where the traces go. The good thing however is everyone uses a more or less reference design for ethernet sockets with isolation transformers. And it's easy to figure out what goes where if you know where to look (so I did).
The board utilizes an isolation transfermer U15 (Yuan Dean Scientific 15FB-10BNL) which includes four differential line isolation in a single package (IN and OUT sockets). The IN socket goes to pins 19, 21 (tx) and 22, 24 (rx). OUT socket uses 16, 18 (tx) and 13, 15 (rx). PoE for the input socket goes to the lower bridge rectifier BR2 (Vishay DF01S).
The fix:
1
@matiaspl
matiaspl / hi3521a_console_output.txt
Last active Jun 27, 2019
Hacking a Hi3521 ARBCV100 4x1 multiviewer / seamless switcher (see comments!)
View hi3521a_console_output.txt
U-Boot 2010.06 (Aug 11 2018 - 18:47:37)
Check Flash Memory Controller v100 ... Found
SPI Nor(cs 0) ID: 0xc2 0x20 0x17
Block:64KB Chip:8MB Name:"MX25L6436F"
SPI Nor total size: 8MB
Cannot found a valid SPI Nand Device
In: serial
Out: serial
Err: serial
@matiaspl
matiaspl / gist:23248eedc23b0890b8cadc59dc9a62c3
Created Nov 20, 2018
gstreamer pipelines with Intel HW acceleration
View gist:23248eedc23b0890b8cadc59dc9a62c3
gst-launch-1.0 --gst-debug=2 -ev mpegtsmux name="muxer" \
souphttpsrc location=http://stream/url ! parsebin ! queue ! vaapih264dec ! vaapipostproc deinterlace-mode=1 deinterlace-method=4 width=1280 height=720 ! vaapih265enc rate-control=vbr bitrate=2000 keyframe-period=50 max-bframes=0 quality-level=4 ! video/x-h265,stream-format=hvc1 ! queue ! h265parse config-interval=1 ! video/x-h265,alignment=au,stream-format=byte-stream ! muxer. tcpserversink host=0.0.0.0 port=1234
TS: VAAPI H264 to H265 transcode with deinterlacing
gst-launch-1.0 --gst-debug=2 -ev
souphttpsrc location=http://stream/url ! parsebin ! queue ! vaapih264dec ! vaapipostproc deinterlace-mode=1 deinterlace-method=4 width=1280 height=720 ! vaapih265enc rate-control=vbr bitrate=2000 keyframe-period=50 max-bframes=0 quality-level=4 ! video/x-h265,stream-format=hvc1 ! queue ! h265parse config-interval=1 ! video/x-h265,alignment=au,stream-format=byte-stream ! mpegtsmux name="muxer" ! tcpserversink host=0.0.0.0 port=1234
TS: audio transcode
gst-la
@matiaspl
matiaspl / gist:2a5775d13249d21da465e667c59e6d83
Last active May 23, 2016
Convert a bunch of MTS files from a camera to a sort-of-HTML5-compatible MP4's (while keeping the directory structure)
View gist:2a5775d13249d21da465e667c59e6d83
find /base_folder -name "*.MTS" -exec sh -c 'ffmpeg -n -i "$0" -c:v copy -c:a libfdk_aac "`basename "$0" .MTS`.mp4"' '{}' \;
Note:
The video track in the original MTS files most likely are H.264 High Profile, so they are not mobile-friendly.
Beware that the resulting MP4's may not play on older devices mobile. Change the base_folder according to your needs.
You can’t perform that action at this time.