Skip to content

Instantly share code, notes, and snippets.

View Bingnan's full-sized avatar
:octocat:
Working from home

段兵楠 Bingnan

:octocat:
Working from home
  • 美团
  • 北京
View GitHub Profile
import time
import win32api, win32con
VK_CODE = {'left_arrow':0x25,
'spacebar':0x20,
'right_arrow':0x27}
def press(x):
win32api.keybd_event(VK_CODE[x], 0,0,0)
win32api.keybd_event(VK_CODE[x],0 ,win32con.KEYEVENTF_KEYUP ,0)
@chzyer
chzyer / go-concurrent-programming.md
Last active June 30, 2020 02:27
golang并发编程 - 例子解析

最近在看《Programming in Go》, 其中关于并发编程写得很不错, 受益非浅, 其中有一些例子是需要多思考才能想明白的, 所以我打算记录下来, 强化一下思路

《Programming in Go》在 Chapter 7. Concurrent Programming 里面一共用3个例子来讲述并发编程的3个模式, 第一个是 filter , 筛选出后缀名和文件大小文件列表, 还算简单就不说, 然后第二个是升级版, 正则版 filter , 不同的是他是根据正则搜索出文件的文本并且列出来. 这个例子我起初看是有点蒙的, 这样写是没错, 但是为什么要这样写, 他的设计思路是什么, 和其他方法相比他有什么优势, 这些都不清楚, 于是决定好好分析一下. 实际上这个例子实现的功能并不复杂, 所以我的文章实际上是在讨论怎么产生出和作者相似的思路.

如果不考虑用 goroutine 的话, 思路其实很简单:

1. 列出文件列表, 编译正则.
2. 遍历文件, 打开并遍历每行, 如果正则能匹配, 记录下来.
3. 列出来.
@tylerneylon
tylerneylon / learn.lua
Last active April 26, 2025 14:17
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
@dcollien
dcollien / c_json_servlet.c
Last active August 12, 2020 10:50
C program for a libevent server receiving JSON requests and replying with JSON responses over HTTP
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <event.h>
#include <evhttp.h>
@imcaspar
imcaspar / mmcat.sh
Created February 3, 2014 02:17
mmcat.sh
#!/bin/bash
################################################################################
#
# Script name: MultiMedia Concat Script (mmcat)
# Author: burek ([email protected])
# License: GNU/GPL, see http://www.gnu.org/copyleft/gpl.html
# Date: 2012-07-14
#
# This script concatenates (joins, merges) several audio/video inputs into one
@v5tech
v5tech / ffmpeg.md
Last active October 14, 2024 19:57
ffmpeg视频合并、格式转换、截图

使用ffmpeg合并MP4文件

ffmpeg -i "Apache Sqoop Tutorial Part 1.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i "Apache Sqoop Tutorial Part 2.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "Apache Sqoop Tutorial Part 3.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts
ffmpeg -i "Apache Sqoop Tutorial Part 4.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate4.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermediate3.ts|intermediate4.ts" -c copy -bsf:a aac_adtstoasc "Apache Sqoop Tutorial.mp4"

adobe 官方标准

  • F4V/FLV file format (其中, Annex E 为 FLV File Format)
  • 有一些 box 是 Adobe 自定义的, 其他的 box 是标准 ISO/IEC 14496-12:2008 (MPEG-4 Part 12) 定义的.
  • F4V 几乎跟 MP4 一样(通常修改文件名为 .mp4 也能播放).
  • FLV 是 Adobe Flash Video 的旧的标准.
  • FLV, F4V, MP4都可以包含 H.264 编码的视频.

FLV文件格式解析

  • 存储多字节数字用大端序.

video subtitle

ffmpeg -i *.mp4 -vf subtitles=*.srt output.mp4

element stream to ts

  • ffmpeg -i audio.aac -i ch2.h264 -acodec copy -vcodec copy -f mpegts out.ts

rtsp 2 rtmp

  • ffmpeg -rtsp_transport tcp -i rtsp://fuck.com/fuck/fuck -c copy -f flv rtmp://shit.com/shit/shit

截图片

git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@Akagi201
Akagi201 / gop.md
Last active April 13, 2017 08:07

这应该是gop影响的 编码的时候要指定一下gop大小 如果要低时延gop大小建议不要小于frame rate的大小 切片的时候除了考虑到时间问题,还要考虑从关键帧那里下刀 如果关键帧很长的话,这边还会强制切片,强制切切的算法是按最大10Mb码率来算它的总大小 超过了,不管有没有关键帧都要切片 所以当关键帧很大的时候会存在你这个问题,码率越大,切片越小 换过来说,延时越小 因此,问题主要解决办法是减小gop大小 但减小gop大小,会影响质量,相同码率,gop越大,质量越好,反之越差,这要做一些折中