Skip to content

Commit 191e635

Browse files
committed
Upgrade to 7.1.0
1 parent 20d44d0 commit 191e635

6 files changed

+222
-179
lines changed

Build.alpine.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# FFMPEG BASE PACKAGES
22
OS_NAME=alpine
33
OS_VERSION=3.20
4-
FFMPEG_VERSION=7.0.2
4+
FFMPEG_VERSION=7.1

Build.ubuntu.cuda11.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ OS_NAME=ubuntu
33
OS_VERSION=22.04
44
CUDA_VERSION=11.8.0
55
FFNVCODEC_VERSION=11.1.5.3
6-
FFMPEG_VERSION=7.0.2
6+
FFMPEG_VERSION=7.1

Build.ubuntu.cuda12.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ OS_NAME=ubuntu
33
OS_VERSION=24.04
44
CUDA_VERSION=12.6.1
55
FFNVCODEC_VERSION=12.1.14.0
6-
FFMPEG_VERSION=7.0.2
6+
FFMPEG_VERSION=7.1

Build.ubuntu.vaapi.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# FFMPEG VAAPI PACKAGES
22
OS_NAME=ubuntu
33
OS_VERSION=24.04
4-
FFMPEG_VERSION=7.0.2
4+
FFMPEG_VERSION=7.1

contrib/ffmpeg-hls.patch

+30-62
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
From 5a2b6b0c5c700a56ea37c62aaebb57ffe2ad8d1f Mon Sep 17 00:00:00 2001
1+
From 4609c8356bfbb063a6111aac4c7fa090099aa05b Mon Sep 17 00:00:00 2001
22
From: Ingo Oppermann <[email protected]>
3-
Date: Fri, 26 Jul 2024 16:59:08 +0200
4-
Subject: [PATCH v6] HLS extensions (ffmpeg 7.0)
3+
Date: Wed, 16 Oct 2024 14:47:06 +0200
4+
Subject: [PATCH v1] hls (7.1.0)
55

66
---
7-
README.HLS.md | 48 ++++++++++++++++++++++++
8-
libavformat/hlsenc.c | 87 +++++++++++++++++++++++++++++++++++++++++---
9-
2 files changed, 130 insertions(+), 5 deletions(-)
7+
README.HLS.md | 48 ++++++++++++++++++++++++++++++++++
8+
libavformat/hlsenc.c | 62 ++++++++++++++++++++++++++++++++++++++++++++
9+
2 files changed, 110 insertions(+)
1010
create mode 100644 README.HLS.md
1111

1212
diff --git a/README.HLS.md b/README.HLS.md
@@ -64,18 +64,18 @@ index 00000000..5462338b
6464
+
6565
+In the command, the `-var_stream_map` option had the value `v:0,a:0 v:1,a:1`.
6666
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
67-
index 2202ce64..1660cace 100644
67+
index 1e932b7b..7b76a227 100644
6868
--- a/libavformat/hlsenc.c
6969
+++ b/libavformat/hlsenc.c
70-
@@ -123,6 +123,7 @@ typedef struct VariantStream {
70+
@@ -125,6 +125,7 @@ typedef struct VariantStream {
7171
AVIOContext *out;
7272
AVIOContext *out_single_file;
7373
int packets_written;
7474
+ uint64_t bytes_written;
7575
int init_range_length;
7676
uint8_t *temp_buffer;
7777
uint8_t *init_buffer;
78-
@@ -137,6 +138,8 @@ typedef struct VariantStream {
78+
@@ -139,6 +140,8 @@ typedef struct VariantStream {
7979
double dpp; // duration per packet
8080
int64_t start_pts;
8181
int64_t end_pts;
@@ -84,56 +84,24 @@ index 2202ce64..1660cace 100644
8484
int64_t video_lastpos;
8585
int64_t video_keyframe_pos;
8686
int64_t video_keyframe_size;
87-
@@ -1374,7 +1377,7 @@ static int create_master_playlist(AVFormatContext *s,
88-
AVStream *vid_st, *aud_st;
89-
AVDictionary *options = NULL;
90-
unsigned int i, j;
91-
- int ret, bandwidth;
92-
+ int ret, bandwidth, st_bandwidth, est_bandwidth;
93-
const char *m3u8_rel_name = NULL;
94-
const char *vtt_m3u8_rel_name = NULL;
95-
const char *ccgroup;
96-
@@ -1486,10 +1489,35 @@ static int create_master_playlist(AVFormatContext *s,
97-
}
98-
99-
bandwidth = 0;
100-
- if (vid_st)
101-
- bandwidth += get_stream_bit_rate(vid_st);
102-
- if (aud_st)
103-
- bandwidth += get_stream_bit_rate(aud_st);
104-
+ est_bandwidth = 0;
105-
+
106-
+ if (vid_st) {
107-
+ st_bandwidth = get_stream_bit_rate(vid_st);
108-
+ if (st_bandwidth == 0) {
109-
+ est_bandwidth = 1;
110-
+ } else {
111-
+ bandwidth += st_bandwidth;
87+
@@ -1507,6 +1510,16 @@ static int create_master_playlist(AVFormatContext *s,
88+
bandwidth += get_stream_bit_rate(vid_st);
89+
if (aud_st)
90+
bandwidth += get_stream_bit_rate(aud_st);
91+
+
92+
+ if (bandwidth == 0) {
93+
+ // Estimate bandwidth
94+
+ bandwidth = (int)round((double)vs->bytes_written / (av_q2d(AV_TIME_BASE_Q) * (vs->scaled_cur_pts - vs->scaled_start_pts)) * 8);
95+
+
96+
+ // Reset counters
97+
+ vs->bytes_written = 0;
98+
+ vs->scaled_start_pts = vs->scaled_cur_pts;
11299
+ }
113-
+ }
114-
+ if (aud_st) {
115-
+ st_bandwidth = get_stream_bit_rate(aud_st);
116-
+ if (st_bandwidth == 0) {
117-
+ est_bandwidth = 1;
118-
+ } else {
119-
+ bandwidth += st_bandwidth;
120-
+ }
121-
+ }
122100
+
123-
+ if (est_bandwidth != 0) {
124-
+ // Estimate bandwidth
125-
+ bandwidth = (int)round((double)vs->bytes_written / (av_q2d(AV_TIME_BASE_Q) * (vs->scaled_cur_pts - vs->scaled_start_pts)) * 8);
126-
+
127-
+ // Reset counters
128-
+ vs->bytes_written = 0;
129-
+ vs->scaled_start_pts = vs->scaled_cur_pts;
130-
+ }
131-
+
132-
+ // Add 10% of the bandwidth to itself
133-
bandwidth += bandwidth / 10;
101+
bandwidth += bandwidth / 10;
102+
}
134103

135-
ccgroup = NULL;
136-
@@ -2461,6 +2489,19 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
104+
@@ -2475,6 +2488,19 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
137105
return AVERROR(ENOMEM);
138106
}
139107

@@ -153,15 +121,15 @@ index 2202ce64..1660cace 100644
153121
end_pts = hls->recording_time * vs->number;
154122

155123
if (vs->sequence - vs->nb_entries > hls->start_sequence && hls->init_time > 0) {
156-
@@ -2681,6 +2722,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
124+
@@ -2700,6 +2726,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
157125
}
158126

159127
vs->packets_written++;
160128
+ vs->bytes_written += (uint64_t)pkt->size;
161129
if (oc->pb) {
162130
ret = ff_write_chained(oc, stream_index, pkt, s, 0);
163131
vs->video_keyframe_size += pkt->size;
164-
@@ -2868,6 +2910,36 @@ failed:
132+
@@ -2888,6 +2915,36 @@ failed:
165133
return 0;
166134
}
167135

@@ -198,7 +166,7 @@ index 2202ce64..1660cace 100644
198166

199167
static int hls_init(AVFormatContext *s)
200168
{
201-
@@ -2975,6 +3047,8 @@ static int hls_init(AVFormatContext *s)
169+
@@ -2995,6 +3052,8 @@ static int hls_init(AVFormatContext *s)
202170
vs->sequence = hls->start_sequence;
203171
vs->start_pts = AV_NOPTS_VALUE;
204172
vs->end_pts = AV_NOPTS_VALUE;
@@ -207,7 +175,7 @@ index 2202ce64..1660cace 100644
207175
vs->current_segment_final_filename_fmt[0] = '\0';
208176
vs->initial_prog_date_time = initial_program_date_time;
209177

210-
@@ -3117,6 +3191,9 @@ static int hls_init(AVFormatContext *s)
178+
@@ -3137,6 +3196,9 @@ static int hls_init(AVFormatContext *s)
211179
vs->number++;
212180
}
213181

@@ -218,7 +186,7 @@ index 2202ce64..1660cace 100644
218186
}
219187

220188

221-
base-commit: 9f0f680f9ab1ca72edd94de42aef12209c11a6b2
189+
base-commit: e1601d14100f6c7d088eba676d9555118ca94931
222190
--
223-
2.39.3 (Apple Git-146)
191+
2.39.5 (Apple Git-154)
224192

0 commit comments

Comments
 (0)