Hi there I have an input coming from an rtsp source in 2 second increments to convert to a HLS stream. The stream itself seems fine. However I do sometimes get the warning:
*Non-monotonous DTS in output stream 0:0* my current command for obtaining the stream is *-stimeout 60000000 -y -rtsp_transport tcp -use_wallclock_as_timestamps 1 -i {url} -c:v copy -hls_segment_type mpegts -hls_time 2 -hls_list_size 5 -f hls output.m3u8* The idea was to then concatenate these together to get a full file. However the concatenation generates a file with a very different length. I may do a 10 minute video. When concatenated this comes out to be 15 minutes or more. I figured this was due to the warnings. I thought I could process each segment and re-generate the timestamps. I know all my files are around 2 second long for instance. So re-generate and then concatenate. I am so far having no luck. *I have tried a few different commands below are some examples:* *Reset timestamps* -i "D:\TestFiles\output18.ts" -c:v libx264 -crf 17 -preset veryfast -reset_timestamps 1 "D:\TestFiles\output18_new.ts" *setting framerate and fflags* -i "D:\TestFiles\output18.ts" -r 20 -c:v libx264 -preset veryfast -g 20 -fflags +genpts "D:\TestFiles\output18.mp4" *Vsync and wall clock* -i "D:\TestFiles\output18.ts" -r 20 -use_wallclock_as_timestamps 1 -c:v libx264 -preset veryfast -vsync drop "D:\TestFiles\output18.mp4" The files are generated and I can concatenate them but the time is still off by a lot. Interestingly even when converting a single file from just a ts to an mp4 the files changes more then I expect. For example the file size goes from 260KB to 694KB I have done a lot of tests and they all seem to produce slightly different wrong results. Here is an example from FFPROBE on the 2 files I have run. *ts file* ffprobe version git-2019-11-11-20c5f4d Copyright (c) 2007-2019 the FFmpeg developers built with gcc 9.2.1 (GCC) 20191010 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 35.101 / 56. 35.101 libavcodec 58. 61.100 / 58. 61.100 libavformat 58. 34.101 / 58. 34.101 libavdevice 58. 9.100 / 58. 9.100 libavfilter 7. 66.100 / 7. 66.100 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 Input #0, mpegts, from 'D:\TestFiles\output18.ts': Duration: 00:00:01.99, start: 38.121067, bitrate: 1034 kb/s Program 1 Metadata: service_name : Media Presentation service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080, 20 fps, 24.92 tbr, 90k tbn, 40 tbc *MP4* ffprobe version git-2019-11-11-20c5f4d Copyright (c) 2007-2019 the FFmpeg developers built with gcc 9.2.1 (GCC) 20191010 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 35.101 / 56. 35.101 libavcodec 58. 61.100 / 58. 61.100 libavformat 58. 34.101 / 58. 34.101 libavdevice 58. 9.100 / 58. 9.100 libavfilter 7. 66.100 / 7. 66.100 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\TestFiles\output18.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.34.101 Duration: 00:00:02.05, start: 0.000000, bitrate: 1151 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 1145 kb/s, 20 fps, 20 tbr, 10240 tbn, 40 tbc (default) Metadata: handler_name : VideoHandler The file length is slightly longer on the mp4 at 2.05 instead of 1.99. Some other items have also changed. The length seems to be consistently 2.05 but the bits and tbn seem to change slightly depending on what inputs I use for encoding to the mp4. All I am trying to achieve. I have 10 minutes of ts files. I concatenate them and have a 10 minute video. My guess is that due to the issues with timestamps or an inconsistent frame rate it is causing the issues with the concatenation. I don't mind re-encoding the files and generating new timestamps etc. I can't seem to quite get it to work. I'm not sure if i'm missing something. I have been banging my head against this for a few days now. I know the length of the file (ffprobe gets it correct). I know the fps it should be, so I can add add/remove frames if needed. It would be appreciated if someone could point me in the correct direction. thanks -- Sent from: http://www.ffmpeg-archive.org/ _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".