Skip to content

Instantly share code, notes, and snippets.

@h2oota
Created November 24, 2012 06:33
Show Gist options
  • Save h2oota/4138671 to your computer and use it in GitHub Desktop.
Save h2oota/4138671 to your computer and use it in GitHub Desktop.
ffmpegでワンセグTSをライブストリーミングするためのパッチ
--- ./libavformat/mpegts.c.orig 2012-09-28 10:37:35.000000000 +0900
+++ ./libavformat/mpegts.c 2012-11-24 14:46:00.500221806 +0900
@@ -615,6 +615,8 @@
st->codec->codec_tag = pes->stream_type;
mpegts_find_stream_type(st, pes->stream_type, ISO_types);
+ if (pes->stream_type == 0x06 || pes->stream_type == 0x0d)
+ st->discard = AVDISCARD_ALL;
if ((prog_reg_desc == AV_RL32("HDMV") ||
prog_reg_desc == AV_RL32("HDPR")) &&
st->codec->codec_id == AV_CODEC_ID_NONE) {
--- ./libavformat/mpegtsenc.c.orig 2012-09-28 10:37:35.000000000 +0900
+++ ./libavformat/mpegtsenc.c 2012-11-24 14:45:01.402203203 +0900
@@ -1113,7 +1113,9 @@
buf = data;
size = pkt->size+6;
}
- } else if (st->codec->codec_id == AV_CODEC_ID_AAC) {
+ } else if (st->codec->codec_id == AV_CODEC_ID_AAC
+ /* -c:a copy */
+ && !(st->codec->extradata != NULL && st->codec->extradata_size == 0)) {
if (pkt->size < 2) {
av_log(s, AV_LOG_ERROR, "AAC packet too short\n");
return AVERROR_INVALIDDATA;
--- ./libavformat/segment.c.orig 2012-09-28 10:37:35.000000000 +0900
+++ ./libavformat/segment.c 2012-11-24 14:59:37.676207782 +0900
@@ -157,6 +157,7 @@
if (seg->list_flags & SEGMENT_LIST_FLAG_LIVE)
avio_printf(seg->list_pb,
"#EXT-X-TARGETDURATION:%"PRId64"\n", seg->time / 1000000);
+ avio_flush(seg->list_pb);
}
return ret;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment