mirror of
https://github.com/datarhei/ffmpeg
synced 2025-12-24 13:08:07 +08:00
Add nopts-v1: Ignore packets with unset PTS on streamcopy
This commit is contained in:
@@ -68,6 +68,7 @@ RUN mkdir -p /dist && cd /dist && \
|
||||
COPY ./contrib /contrib
|
||||
|
||||
RUN cd /dist/ffmpeg-${FFMPEG_VERSION} && \
|
||||
patch -p1 < /contrib/ffmpeg-nopts.patch && \
|
||||
patch -p1 < /contrib/ffmpeg-jsonstats.patch && \
|
||||
patch -p1 < /contrib/ffmpeg-hlsbitrate.patch && \
|
||||
./configure \
|
||||
|
||||
@@ -76,6 +76,7 @@ RUN echo $uname
|
||||
RUN cd /dist/ffmpeg-${FFMPEG_VERSION} && \
|
||||
apkArch="$(apk --print-arch)" && if [ $apkArch != "aarch64" ]; then MMAL_SUPPORT="--enable-mmal"; fi && \
|
||||
apkArch="$(apk --print-arch)" && if [ $apkArch != "aarch64" ]; then OMX_SUPPORT="--enable-omx --enable-omx-rpi"; fi && \
|
||||
patch -p1 < /contrib/ffmpeg-nopts.patch && \
|
||||
patch -p1 < /contrib/ffmpeg-jsonstats.patch && \
|
||||
patch -p1 < /contrib/ffmpeg-hlsbitrate.patch && \
|
||||
./configure \
|
||||
|
||||
@@ -182,6 +182,7 @@ RUN mkdir -p /dist && cd /dist && \
|
||||
COPY ./contrib /contrib
|
||||
|
||||
RUN cd /dist/ffmpeg-${FFMPEG_VERSION} && \
|
||||
patch -p1 < /contrib/ffmpeg-nopts.patch && \
|
||||
patch -p1 < /contrib/ffmpeg-jsonstats.patch && \
|
||||
patch -p1 < /contrib/ffmpeg-hlsbitrate.patch && \
|
||||
./configure \
|
||||
|
||||
@@ -180,6 +180,7 @@ RUN mkdir -p /dist && cd /dist && \
|
||||
COPY ./contrib /contrib
|
||||
|
||||
RUN cd /dist/ffmpeg-${FFMPEG_VERSION} && \
|
||||
patch -p1 < /contrib/ffmpeg-nopts.patch && \
|
||||
patch -p1 < /contrib/ffmpeg-jsonstats.patch && \
|
||||
patch -p1 < /contrib/ffmpeg-hlsbitrate.patch && \
|
||||
./configure \
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
# Patches
|
||||
|
||||
FFmpeg patches.
|
||||
|
||||
## No PTS
|
||||
|
||||
Ignore packets during streamcopy that don't have a valid PTS value.
|
||||
|
||||
## HLS bitrate
|
||||
|
||||
Calculate bandwidth estimate for the hls master manifest.
|
||||
|
||||
|
||||
## JSON stats
|
||||
|
||||
This repository contains a patch for the FFmpeg program to provide detailed progress information. With this patch, FFmpeg will output
|
||||
the progress information in a JSON string that contains the data for each input and output stream individually. The JSON output is enabled
|
||||
by default. It can be enabled with the global `-jsonstats` switch on the command line. Use the `-stats` switch
|
||||
@@ -28,71 +33,71 @@ The same output but nicely formatted:
|
||||
|
||||
```json
|
||||
{
|
||||
"bitrate_kbps": 1367.7,
|
||||
"drop": 0,
|
||||
"dup": 0,
|
||||
"fps": 24.95,
|
||||
"frame": 188,
|
||||
"inputs": [
|
||||
{
|
||||
"bitrate_kbps": 552960.0,
|
||||
"codec": "rawvideo",
|
||||
"coder": "rawvideo",
|
||||
"fps": 24.95,
|
||||
"frame": 188,
|
||||
"height": 720,
|
||||
"id": 0,
|
||||
"pix_fmt": "rgb24",
|
||||
"size_kb": 507600,
|
||||
"stream": 0,
|
||||
"type": "video",
|
||||
"width": 1280
|
||||
},
|
||||
{
|
||||
"bitrate_kbps": 705.6,
|
||||
"codec": "pcm_u8",
|
||||
"coder": "pcm_u8",
|
||||
"frame": 314,
|
||||
"id": 1,
|
||||
"layout": "stereo",
|
||||
"sampling_hz": 44100,
|
||||
"size_kb": 628,
|
||||
"stream": 0,
|
||||
"type": "audio"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"bitrate_kbps": 1365.6,
|
||||
"codec": "h264",
|
||||
"coder": "libx264",
|
||||
"fps": 24.95,
|
||||
"frame": 188,
|
||||
"height": 720,
|
||||
"id": 0,
|
||||
"pix_fmt": "yuv420p",
|
||||
"q": -1.0,
|
||||
"size_kb": 1247,
|
||||
"stream": 0,
|
||||
"type": "video",
|
||||
"width": 1280
|
||||
},
|
||||
{
|
||||
"bitrate_kbps": 2.1,
|
||||
"codec": "aac",
|
||||
"coder": "aac",
|
||||
"frame": 315,
|
||||
"id": 0,
|
||||
"layout": "stereo",
|
||||
"sampling_hz": 44100,
|
||||
"size_kb": 2,
|
||||
"stream": 1,
|
||||
"type": "audio"
|
||||
}
|
||||
],
|
||||
"q": -1.0,
|
||||
"size_kb": 1249,
|
||||
"speed": 0.993,
|
||||
"time": "0h0m7.48s"
|
||||
"bitrate_kbps": 1367.7,
|
||||
"drop": 0,
|
||||
"dup": 0,
|
||||
"fps": 24.95,
|
||||
"frame": 188,
|
||||
"inputs": [
|
||||
{
|
||||
"bitrate_kbps": 552960.0,
|
||||
"codec": "rawvideo",
|
||||
"coder": "rawvideo",
|
||||
"fps": 24.95,
|
||||
"frame": 188,
|
||||
"height": 720,
|
||||
"id": 0,
|
||||
"pix_fmt": "rgb24",
|
||||
"size_kb": 507600,
|
||||
"stream": 0,
|
||||
"type": "video",
|
||||
"width": 1280
|
||||
},
|
||||
{
|
||||
"bitrate_kbps": 705.6,
|
||||
"codec": "pcm_u8",
|
||||
"coder": "pcm_u8",
|
||||
"frame": 314,
|
||||
"id": 1,
|
||||
"layout": "stereo",
|
||||
"sampling_hz": 44100,
|
||||
"size_kb": 628,
|
||||
"stream": 0,
|
||||
"type": "audio"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"bitrate_kbps": 1365.6,
|
||||
"codec": "h264",
|
||||
"coder": "libx264",
|
||||
"fps": 24.95,
|
||||
"frame": 188,
|
||||
"height": 720,
|
||||
"id": 0,
|
||||
"pix_fmt": "yuv420p",
|
||||
"q": -1.0,
|
||||
"size_kb": 1247,
|
||||
"stream": 0,
|
||||
"type": "video",
|
||||
"width": 1280
|
||||
},
|
||||
{
|
||||
"bitrate_kbps": 2.1,
|
||||
"codec": "aac",
|
||||
"coder": "aac",
|
||||
"frame": 315,
|
||||
"id": 0,
|
||||
"layout": "stereo",
|
||||
"sampling_hz": 44100,
|
||||
"size_kb": 2,
|
||||
"stream": 1,
|
||||
"type": "audio"
|
||||
}
|
||||
],
|
||||
"q": -1.0,
|
||||
"size_kb": 1249,
|
||||
"speed": 0.993,
|
||||
"time": "0h0m7.48s"
|
||||
}
|
||||
```
|
||||
|
||||
31
contrib/ffmpeg-nopts.patch
Normal file
31
contrib/ffmpeg-nopts.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From 357b3d157b08ca5c7b91f605136bf140a4453fe7 Mon Sep 17 00:00:00 2001
|
||||
From: Ingo Oppermann <ingo@datarhei.com>
|
||||
Date: Tue, 16 May 2023 11:19:17 +0200
|
||||
Subject: [PATCH v1] Ignore packets with unset PTS on streamcopy
|
||||
|
||||
---
|
||||
fftools/ffmpeg.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
|
||||
index e7384f05..3385482b 100644
|
||||
--- a/fftools/ffmpeg.c
|
||||
+++ b/fftools/ffmpeg.c
|
||||
@@ -1858,8 +1858,11 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
|
||||
if (av_packet_ref(opkt, pkt) < 0)
|
||||
exit_program(1);
|
||||
|
||||
- if (pkt->pts != AV_NOPTS_VALUE)
|
||||
+ if (pkt->pts != AV_NOPTS_VALUE) {
|
||||
opkt->pts = av_rescale_q(pkt->pts, ist->st->time_base, ost->mux_timebase) - ost_tb_start_time;
|
||||
+ } else {
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
if (pkt->dts == AV_NOPTS_VALUE) {
|
||||
opkt->dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ost->mux_timebase);
|
||||
|
||||
base-commit: 2bca71f4986725d7cf0d441e2f82a790d0a0c717
|
||||
--
|
||||
2.39.2 (Apple Git-143)
|
||||
|
||||
Reference in New Issue
Block a user