Replies: 5 comments
-
I was trying to find a solution in various ways, but something is seriously wrong with your example input stream! There are several ways to approach the problem and I tested them using the stream (live) or the downloaded video (as mp4). Option 1 (single fragment, maybe also possible using PyAV):
Sources: Problems:
Option 2 (segment muxer, here using downloaded video):
(creating first 6 fragments from downloaded file) Sources: Problems:
Option 3 (reassigning timestamps via raw h264 stream, somewhat possible with PyAV):Sources: Problems:
Conclusion:
Tools used:
Hints
|
Beta Was this translation helpful? Give feedback.
-
I explored option 1 from my previous post also using PyAV (v8,0,2) with a modified version of your script:
Well, in this later stage I also tried to manipulate the timestamps of each packet, but I originally was expecting this to be not needed. It finally fails as there are probably weird timestamp issues within the example file, that one has to deal with and fix somehow. I mostly was interested in whether PyAV allows you setting the muxer option "avoid_negative_ts" to maybe force ffmpeg to reset the timestamps in each output fragment! Looking at the ffmpeg documentation it definitely seems to be an option on the muxer/container though:
As I couldn't make it work even using the ffmpeg CLI tool, I stopped trying. References: |
Beta Was this translation helpful? Give feedback.
-
Fixed (working now!)Sorry my posted modification of your script still had a small bug, that produced a "non-monotonic error" as the initial packet for the next fragment had the previous offset applied.
I also took the time to look at the internals of ffmpeg and PyAV to check what is going on while muxing using the segment muxer with ffmpeg or the OutputContainer with PyAV. References: |
Beta Was this translation helpful? Give feedback.
-
Using following ffmpeg command and it seems to run smoothly Your solution is good but still it breaks if we use the live stream and not on the downloaded file. In the real project i'm using live feed IP Cameras URLs that have the same problem. |
Beta Was this translation helpful? Give feedback.
-
It might be a stream problem and we can't work around it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Overview
I'm trying to split a rtsp stream in multiple files. I was successfull doing it but the files that came out have a time length issue, it increments the last file length on his own. I'm doing 10 seconds cuts for each file, the first file gets 10 seconds but the second file gets 20 seconds time length with 10 seconds of content, the third get 30 seconds file with last 10 seconds of data only.
Here is my code:
Expected behavior
Each file produced should be 10 seconds on metadata.
Actual behavior
The files gets larger time length, if you open the file it shows no image up until the last 10 seconds of the file.
Investigation
I've tried to change pts and dts timers but it changes nothing.
I also tried to look for changing the metadada in container or the stream, but found nothing
Beta Was this translation helpful? Give feedback.
All reactions