Skip to content

Instantly share code, notes, and snippets.

View moonpfe's full-sized avatar

InCheol Moon moonpfe

  • EMSTONE CO., Ltd
  • Seoul
  • 11:33 (UTC +09:00)
View GitHub Profile
@moonpfe
moonpfe / sh
Created August 2, 2018 05:36
set mac address depending on device name
setup_mac_address() {
local device=$1
local mac=$(ip link show $device | grep "link/ether\b" | awk '{print $2}')
[ "$mac" = "00:00:00:00:00:00" ] || return
local interfaces=`rtcap -l`
if [ "$interfaces" = "" ]; then
return
@moonpfe
moonpfe / 0001-link-extract-codec-extradata-size-if-it-is-need.patch
Created August 21, 2018 06:11
extract codec extradata size if it is need
@moonpfe
moonpfe / mp4serv-use-ffmpeg-adpcm-decoder.patch
Created August 23, 2018 05:05
FFmpeg ADPCM 디코더를 사용하여 오디오 디코딩
From c69c805fc1194e225c3f2ddd2c7429f827d3684e Mon Sep 17 00:00:00 2001
From: InCheol Moon <moonpfe@emstone.com>
Date: Thu, 23 Aug 2018 14:03:55 +0900
Subject: [PATCH] mp4serv: use ffmpeg adpcm decoder
---
src/mp4serv.c | 84 ++++++++++++++++++++-------------------------------
1 file changed, 32 insertions(+), 52 deletions(-)
diff --git a/src/mp4serv.c b/src/mp4serv.c
@moonpfe
moonpfe / get_codec_extradata.c
Created August 24, 2018 05:06
Get codec extradata from video frame
static uint8_t *
mp4serv_get_codec_extradata (EdcBuf *frame,
int *extradata_size)
{
AVBSFContext *bsf;
const AVBitStreamFilter *f;
const enum AVCodecID *ids;
AVPacket *dst_pkt;
int avcodec_id;
int found;
@moonpfe
moonpfe / edc-rtsp-no-adpcm.patch
Last active August 28, 2018 05:08
RTSP 카메라에서 수신한 PCMA 오디오를 AAC로 트랜스 코딩하여 fMP4 형식으로 내보내기
diff --git a/edc-rtsp.c b/edc-rtsp.c
index 161ca75d..6a2fe275 100644
--- a/edc-rtsp.c
+++ b/edc-rtsp.c
@@ -902,7 +902,7 @@ edc_rtsp_make_audio_frame (EdcRtsp *rtsp,
buf = edc_buf_new_for_frame (pkt->size);
buf->channel = 0;
buf->flags = EDC_BUF_FLAG_AUDIO;
- buf->codec_id = rtsp->audio.codec_id;
+ buf->codec_id = EDC_CODEC_ALAW;
@moonpfe
moonpfe / use-ffmpeg-adpcm-decoder.patch
Created August 24, 2018 06:54
카메라에서 수신한 PCMA 오디오 패킷을 FFmpeg ADPCM 인코더로 재인코딩하고 디코딩하기
diff --git a/src/mp4serv.c b/src/mp4serv.c
index 4b84abc30..f73d7704b 100644
--- a/src/mp4serv.c
+++ b/src/mp4serv.c
@@ -123,21 +123,18 @@ struct _Mp4ServClient
struct
{
- EdcAdpcm *decoder;
+ AVCodecContext *decoder;
@moonpfe
moonpfe / use-rtsp-rtp-timestamp.patch
Created August 29, 2018 04:42
수신한 시간이 아닌 RTSP/RTP 패킷의 시간 정보를 이용
diff --git a/edc-rtsp.c b/edc-rtsp.c
index 161ca75d..8438cfb8 100644
--- a/edc-rtsp.c
+++ b/edc-rtsp.c
@@ -20,6 +20,7 @@
#include <libswresample/swresample.h>
#include <libavutil/random_seed.h>
#include <libavutil/intreadwrite.h>
+#include <libavutil/timestamp.h>
@moonpfe
moonpfe / audio-resampling-by-using-avfiler.patch
Created August 31, 2018 01:30
AVFilter를 사용하여 오디오 샘플링 변경
diff --git a/edc-rtsp.c b/edc-rtsp.c
index 161ca75d..e73aecdf 100644
--- a/edc-rtsp.c
+++ b/edc-rtsp.c
@@ -20,6 +20,11 @@
#include <libswresample/swresample.h>
#include <libavutil/random_seed.h>
#include <libavutil/intreadwrite.h>
+#include <libavutil/timestamp.h>
+#include <libavfilter/avfilter.h>
@moonpfe
moonpfe / use-ffmpeg-adpcm-resampler-framesize.patch
Last active August 31, 2018 04:09
RTP 시간 사용, FFmpeg 인코더로 인코딩, AVFilter 사용하여 리셈플링, ADPCM 프레임 크기 적용
diff --git a/edc-codec.c b/edc-codec.c
index b4aa4278..206c0d46 100644
--- a/edc-codec.c
+++ b/edc-codec.c
@@ -579,7 +579,7 @@ edc_codec_new (EdcCodecID codec_id,
else
codec->context_name = edc_strdup (codec->is_video ? "video" : "audio");
- if (codec_id == EDC_CODEC_ADPCM)
+ if (0 && codec_id == EDC_CODEC_ADPCM)
@moonpfe
moonpfe / use-rtp-timestamp-and-set-frame-size-to-2040.patch
Created September 3, 2018 07:34
RTP 시간을 사용하고, 오디오를 2040 샘플 단위로 ADPCM으로 인코딩
From a860ebd0e3b0555aed30eb7e70920687f3651104 Mon Sep 17 00:00:00 2001
From: InCheol Moon <moonpfe@emstone.com>
Date: Mon, 3 Sep 2018 16:31:07 +0900
Subject: [PATCH] rtsp: use rtp timestamp and set frame size to 2040
---
edc-rtsp.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 76 insertions(+), 3 deletions(-)
diff --git a/edc-rtsp.c b/edc-rtsp.c