[FFmpeg-devel] [PATCH] [RFC] libavformat/mpegts: Prevent wrapping of PTS & DTS
DeHackEd
git at dehacked.net
Sun Jun 12 20:59:14 CEST 2016
On 06/12/2016 02:31 PM, Carl Eugen Hoyos wrote:
> DeHackEd <git <at> dehacked.net> writes:
>
>> The effects vary a bit. One guy in IRC basically had ffmpeg
>> crash for him every 26.5 hours when he was saving to HLS
>
> And when I asked him how I can reproduce this issue he
> unfortunately couldn't answer;-(
I pasted output from ffmpeg way back at the start of this thread.
If you're not using libav (or you are and your application doesn't correct for the timestamp wrap itself) then you can
get the API experience with -copyts in the ffmpeg command.
$ ffmpeg -i longvideo.ts -c copy -f mpegts -copyts output.ts
[mpegts @ 0x245f460] Invalid timestamps stream=0, pts=43408, dts=8589888000, size=535
[mpegts @ 0x245f460] Invalid timestamps stream=0, pts=7408, dts=8589906000, size=157
[null @ 0x2465180] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8589924000 >= 7408
[null @ 0x2465180] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8589924000 >= 25408
[null @ 0x2465180] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8589924000 >= 43408
...
In libav calling av_write_frame() with non-monontonic timestamps will return an error. In ffmpeg the video will be cut
off or otherwise damaged at 26.5 hours.
The guy in IRC had this convoluted command-line where he piped from ffmpeg to NvTranscoder (sample app in the nvenc SDK)
and back through ffmpeg. The commend-line pasted was:
/home/ffmpeg-3.0.1/ffmpeg -i - -codec copy -f mpegts - 2>/var/log/channels/${CHN}/input.txt < "$fifo" &
encode+=($!)|NvTranscoder -size 1280 720 -i /dev/stdin -o /dev/stdout -bitrate 1800000 -vbvMaxBitrate 2500000 -vbvSize
1000000 -deviceID $2 $NVENC_OPTS |/home/ffmpeg-3.0.1/ffmpeg -fflags +genpts -i - -c:v copy -c:a aac -b:a 128k -ac 2
-timestamp now -f hls -hls_time 6 -hls_flags delete_segments -hls_list_size 5 ${HLS_PATH}/${CHN}/${CHN}2M.m3u8
2>/var/log/channels/${CHN}/720p.txt
... and as for the outputs, all his pastebin records have expired.
>
> Carl Eugen
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list