Re: [FFmpeg-user] Some Questions on Time Delta between Frame Display and Frame Capture. Thoughts?
> > I think you need to take a step back. You have your nose on a specific > issue, but you have neglected to explain the big picture: what are you > trying to achieve that requires that level of accuracy? I want to record the streaming of video on LCD with accurate timestamps overlayed on each frame. How that timestamp will be overlaid is a separate question under discussion in email with the subject: Recorded Frame Timestamps are Inconsistent! How to Fix it? ___ 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".
Re: [FFmpeg-user] Recorded Frame Timestamps are Inconsistent! How to Fix it?
> > This filter chain looks either useless or broken. > Given the discussion above and the question under discussion, can you please give a command to achieve the accurate timestamping of the frames? Or suggest any other solution. Thanks. -- Regards Hassan Iqbal ___ 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".
[FFmpeg-user] Some Questions on Time Delta between Frame Display and Frame Capture. Thoughts?
Hello, I have few questions about FPS while recording a video. Suppose, I am capturing a video by recording my desktop. The video is playing at 60 FPS. My frame rate for capturing is also set at 60 FPS. Ideally, at 60 FPS, each of the subsequent frames is 16.6 msec apart. For this scenario, I have the following questions: 1. Does FFmpeg record desktop at the refresh rate of the LCD, like whenever a new frame is displayed, does it captures it right away or it records at its own set fixed rate? 2. What is the likely delta between the time (t1) when a frame of the video appears on LCD and the time (t2) when the FFmpeg captures? For example, since the inter-frame interval is 16.6 msec, in the worse case, is it possible that t2-t1 is approximately 16 msec? 3. If the answer to question (2) is yes, then how do we address this issue to reduce this delta? One top-of-the-head solution to question 3 is to record a video at a higher frame-rate, say 120 FPS. However, if this works, it will reduce the error by 50%. What are better approaches to address this problem? Thanks. -- Regards Hassan Iqbal ___ 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".
Re: [FFmpeg-user] Recorded Frame Timestamps are Inconsistent! How to Fix it?
> > Try this: > ffmpeg -f gdigrab -i desktop -vf "settb=expr=1/72, setpts=N*12000, > fps=60" -c:v libx264rgb > -preset ultrafast ./test_SD_1.mkv > See if it works. > > \ffmpeg> ffmpeg -f gdigrab -i desktop -vf "settb=expr=1/72, setpts=N*12000, fps=60" -c:v libx264rgb -preset ultrafast ./test_SD_1.mkv ffmpeg version 4.3.2-2021-02-20-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers pencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat58. 45.100 / 58. 45.100 libavdevice58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc55. 7.100 / 55. 7.100 [gdigrab @ 02755743dc80] Capturing whole desktop as 1920x1080x32 at (0,0) [gdigrab @ 02755743dc80] Stream #0: not enough frames to estimate rate; consider increasing probesize Input #0, gdigrab, from 'desktop': Duration: N/A, start: 1616419007.328868, bitrate: 1988680 kb/s Stream #0:0: Video: bmp, bgra, 1920x1080, 1988680 kb/s, 29.97 fps, 1000k tbr, 1000k tbn, 1000k tbc File './test_SD_1.mkv' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264rgb)) Press [q] to stop, [?] for help [libx264rgb @ 027557442240] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264rgb @ 027557442240] profile High 4:4:4 Predictive, level 4.2, 4:4:4, 8-bit [libx264rgb @ 027557442240] 264 - core 161 r3048 b86ae3c - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0 Output #0, matroska, to './test_SD_1.mkv': Metadata: encoder : Lavf58.45.100 Stream #0:0: Video: h264 (libx264rgb) (H264 / 0x34363248), rgb24, 1920x1080, q=-1--1, 60 fps, 1k tbn, 60 tbc Metadata: encoder : Lavc58.91.100 libx264rgb Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A frame= 588 fps= 30 q=-1.0 Lsize=4425kB time=00:00:09.78 bitrate=3704.7kbits/s speed=0.497x video:4420kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.095925% [libx264rgb @ 027557442240] frame I:3 Avg QP:15.33 size:1206028 [libx264rgb @ 027557442240] frame P:585 Avg QP:15.77 size: 1552 [libx264rgb @ 027557442240] mb I I16..4: 100.0% 0.0% 0.0% [libx264rgb @ 027557442240] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.5% 0.0% 0.0% 0.0% 0.0%skip:99.5% [libx264rgb @ 027557442240] coded y,u,v intra: 33.4% 33.6% 33.4% inter: 0.2% 0.2% 0.2% [libx264rgb @ 027557442240] i16 v,h,dc,p: 65% 30% 3% 1% [libx264rgb @ 027557442240] kb/s:3694.57 Exiting normally, received signal 2. Here is the output of ffprobe on the above recorded video ffmpeg> ffprobe .\test_SD_1.mkv ffprobe version 4.3.2-2021-02-20-essentials_build-www.gyan.dev Copyright (c) 2007-2021 the FFmpeg developers built with gcc 10.2.0 (Rev6, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat58. 45.100 / 58. 45.100 libavdevice58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc55. 7.100 / 55. 7.100 Input #0, matroska,webm, from '.\test_SD_1.mkv': Metadata: ENCODER : Lavf58.45.100
Re: [FFmpeg-user] Recorded Frame Timestamps are Inconsistent! How to Fix it?
So I have modified to recording resolution and applied the offset to capture only the area of interest. It speeds up the capturing of timestamps and I am getting a timestamp on each frame at an interval of (14ms to 18ms). Which is close to ideal 16.6msec for 60 FPS recording, yet not accurate enough. Following is the command. ffmpeg -f gdigrab -framerate 60 -offset_x 550 -offset_y 350 -video_size 640x480 -thread_queue_size 1024 -i desktop -vf "settb=AVTB, setpts='trunc(PTS/1K)*1K+st(1,trunc(RTCTIME/1K))-1K*trunc(ld(1)/1K)', drawtext=fontfile=ArialBold.ttf:fontsize=30:fontcolor=white:text='%{localtime}.%{eif\:1M*t-1K*trunc(t*1K)\:d\:3}.%{n}:fontsize=30:r=60:x=(w-tw)/2: y=h-(2*lh):box=1:boxborderw=20:boxcolor=black@1.0:x=10:y=10'" -c:v libx264rgb -crf 0 -preset ultrafast ./test_SD_1.mkv @Marton: Could you please see the above command and let me know how to add -copyts opinion? Also, when you mentioned the use of '%{pts\:localtime}' variable expansion, it gives an error of Unterminated %{} near '{pts'. Can you please help fix the above command? @Mark: I have tried to modify the setts and setpts options. Below is the command: ffmpeg -f gdigrab -framerate 60 -offset_x 550 -offset_y 350 -video_size 640x480 -thread_queue_size 1024 -i desktop -vf "settb=expr=1/72, setpts=N*12000,fps=60, drawtext=fontfile=ArialBold.ttf:fontsize=40:fontcolor=white:text='%{localtime}.%{eif\:1M*t-1K*trunc(t*1K)\:d}:box=1:boxborderw=20:boxcolor=black@1.0:x=10:y=10'" -c:v libx264rgb -crf 0 -preset ultrafast ./test_SD_1.mkv However, the seconds never increment and the milliseconds loop in three values 0,333,666. Have a set anything incorrect in the command?. I have another challenge. I want to record at FPs higher than 60 FPS, i.e., 120 FPS. For that, i set -framerate 120 and in -vf, I set r=120. However, the recording that I get is just 60 FPS. Is it because my LCD has a refresh rate of 60hz? Or FFmpeg is not concerned about LCD hardware? How can I record at 120 FPS? Another question is regarding the working of FFmpeg. Suppose, I am capturing a video from a desktop that is playing at 60 FPS. My frame rate for capturing is also set at 60 FPS. Is it likely that a frame of video appears on LCD and the ffmpeg captures it at a delta of almost a full frame, i.e., ~16. mec ? If so, then isn't recording a 60 FPS video with -framerate 60 an incorrect choice? On Mon, Mar 15, 2021 at 10:52 PM Mark Filipak (ffmpeg) wrote: > On 2021-03-15 13:43, Hassan wrote: > > Hello, > > > > I am using ffmpeg on a Windows 10 machine and I want to record the > desktop > > at a high frame rate while appending accurate timestamps to each frame. > > I am recording my desktop using the following command: > > > > ffmpeg -f gdigrab -framerate 60 -i desktop -vf "settb=AVTB, > > setpts='trunc(PTS/1K)*1K+st(1,trunc(RTCTIME/1K))-1K*trunc(ld(1)/1K)', > > > drawtext=fontfile=ArialBold.ttf:fontsize=40:fontcolor=white:text='%{localtime}.%{eif\:1M*t-1K*trunc(t*1K)\:d}:box=1:boxborderw=20:boxcolor=black@1.0 > :x=10:y=10'" > > -c:v libx264rgb -crf 0 -preset ultrafast output.mkv > > > > The long text next to -vf flag is used to append timestamp (date and > > current time in milliseconds) on the top left corner of the frame with > > black background. > > > > The issue is that, ideally, when I am recording at 60 FPS, each > subsequent > > frame should have a timestamp with an increment of 16.66 msec. However, > the > > timestamp is not incremented as such. Instead, it stays the same on a lot > > of frames and then changes. > > > > For example, when I break the video into frames, the frame titled > > "img0428.png" has the timestamp 18:44:16.828 (hh:mm:ss.millisec) > > [image: image.png]. > > Then until "next 40 frames, it says the same. On file "img0469.png", the > > timestamp changes and becomes 18:44:17.510. > > [image: image.png] > > So, the timestamp changed after 41 frames and the time difference is 682 > > milliseconds. Ideally, each of the 40 frames between these two frames > > should carry an incremental timestamp by a step size of 16.66 msec but > this > > is not happening. > > Hello Hassan, > > I don't know anything about 'gdigrab' but I have a lot of experience with > frame rate manipulation. > > "I am recording at 60 FPS..." > A little higher than 60 fps. Look: > > (468 - 428 + 1 frames)/(17510[+/-0.5...] - 16828[+/-0.5...] ms)(1000 ms/s) > = 60.029 to 60.206 frames/s. > > "...with an increment of 16.66 msec." > The 'gdigrab' timing resolution may not be +/-0.01 ms. For example, it may > be +/-0.1 ms or even +/-1 ms. > > If you can tolerate setting fps to exactly 60 (you're saving video to > disk, you're not s
[FFmpeg-user] Recorded Frame Timestamps are Inconsistent! How to Fix it?
Hello, I am using ffmpeg on a Windows 10 machine and I want to record the desktop at a high frame rate while appending accurate timestamps to each frame. I am recording my desktop using the following command: ffmpeg -f gdigrab -framerate 60 -i desktop -vf "settb=AVTB, setpts='trunc(PTS/1K)*1K+st(1,trunc(RTCTIME/1K))-1K*trunc(ld(1)/1K)', drawtext=fontfile=ArialBold.ttf:fontsize=40:fontcolor=white:text='%{localtime}.%{eif\:1M*t-1K*trunc(t*1K)\:d}:box=1:boxborderw=20:boxcolor=black@1.0:x=10:y=10'" -c:v libx264rgb -crf 0 -preset ultrafast output.mkv The long text next to -vf flag is used to append timestamp (date and current time in milliseconds) on the top left corner of the frame with black background. The issue is that, ideally, when I am recording at 60 FPS, each subsequent frame should have a timestamp with an increment of 16.66 msec. However, the timestamp is not incremented as such. Instead, it stays the same on a lot of frames and then changes. For example, when I break the video into frames, the frame titled "img0428.png" has the timestamp 18:44:16.828 (hh:mm:ss.millisec) [image: image.png]. Then until "next 40 frames, it says the same. On file "img0469.png", the timestamp changes and becomes 18:44:17.510. [image: image.png] So, the timestamp changed after 41 frames and the time difference is 682 milliseconds. Ideally, each of the 40 frames between these two frames should carry an incremental timestamp by a step size of 16.66 msec but this is not happening. Therefore, my questions are as follows: 1. Am I using the right method to append timestamps to the recorded frames? 2. What is the reason that the timestamping on the frames is not correct? 3. How can I fix this issue? 4. What are the alternate methods to append accurate epoch timestamps to each of the recorded frames? Please guide me. Thanks. -- Regards Hassan Iqbal ___ 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".
[FFmpeg-user] FFmpeg - HLS m3u8 to UDP Output
40bb2647f92ccfc2f97661f/5bfd1702/euronews/euronews-euronews-website-web-responsive-2/ewnsabrenbkp_eng.smil/ewnsabrenbkp_eng_720p.m3u8' for reading [https @ 0216bb119e00] Opening 'https://euronews-en-b13-cdn.hexaglobe.net/aee4dc37c40bb2647f92ccfc2f97661f/5bfd1702/euronews/euronews-euronews-website-web-responsive-2/ewnsabrenbkp_eng.smil/ewnsabrenbkp_eng_720p-20181127110814-42283.ts' for reading [https @ 0216bb167300] Opening 'https://euronews-en-b13-cdn.hexaglobe.net/aee4dc37c40bb2647f92ccfc2f97661f/5bfd1702/euronews/euronews-euronews-website-web-responsive-2/ewnsabrenbkp_eng.smil/ewnsabrenbkp_eng_720p-20181127110822-42284.ts' for reading [https @ 0216bb5861c0] Opening 'https://euronews-en-b13-cdn.hexaglobe.net/aee4dc37c40bb2647f92ccfc2f97661f/5bfd1702/euronews/euronews-euronews-website-web-responsive-2/ewnsabrenbkp_eng.smil/ewnsabrenbkp_eng_720p.m3u8' for reading [https @ 0216bb119e00] Opening 'https://euronews-en-b13-cdn.hexaglobe.net/aee4dc37c40bb2647f92ccfc2f97661f/5bfd1702/euronews/euronews-euronews-website-web-responsive-2/ewnsabrenbkp_eng.smil/ewnsabrenbkp_eng_720p-20181127110830-42285.ts' for reading [https @ 0216bb167300] Opening 'https://euronews-en-b13-cdn.hexaglobe.net/aee4dc37c40bb2647f92ccfc2f97661f/5bfd1702/euronews/euronews-euronews-website-web-responsive-2/ewnsabrenbkp_eng.smil/ewnsabrenbkp_eng_720p-20181127110838-42286.ts' for reading frame= 1246 fps= 25 q=-1.0 Lsize= 13726kB time=00:00:49.77 bitrate=2258.8kbits/s speed= 1x video:12180kB audio:407kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.043862% Exiting normally, received signal 2. As FFmpeg trying to reopen the input, it stops the udp output, which leads the udp output stream to have audio and video freezes . I made another to output to a file (.mp4), the File has no problems, and the stream is recorded well. Can you help me please. Best Regards, Hassan Ghaddar ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] How to have a secure UDP BroadCast
Dears, How to have a secure connection with username and password while broadcasting "UPD" I've use this command ffmpeg -f dshow -video_size 1280x720 -rtbufsize 702000K -framerate 30 -i video="Video (00-0 Pro Capture Quad HDMI)" -r 30 -threads 4 -vcodec libx264 -crf 0 -preset ultrafast -f mpegts "udp://username:password@192.168.1.12:" but it didn't work can you advice me plz. Thanks in advance. *Hassan Shatnawi* Software Developer *Software Development Department* *Haupshy Establishment for Electronics* Al Madina Al Monawara St. bld 31 | P.O.Box 6875 Amman 8, Jordan. *T: *+962 6 5820 927* | F: *+962 6 5820 926* | M: *+962 78 5792 096 *E*: has...@haupshy.com *|* www.haupshy.com ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".