[FFmpeg-trac] #9089(undetermined:new): Modify the system time, resulting in unable to save screen recording

FFmpeg trac at avcodec.org
Sat Feb 20 05:30:21 EET 2021


#9089: Modify the system time, resulting in unable to save screen recording
-------------------------------------+-------------------------------------
             Reporter:  HouLei       |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  git-master   |               Resolution:
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by HouLei):

 Replying to [comment:1 cehoyos]:
 > If you want to report a bug that should be fixed in the FFmpeg codebase
 please test current FFmpeg git head and provide the command line you
 tested together with the complete, uncut console output.

 > commit 029e3c1c70b31ede9f17dda4b3a4fc8e35cada70 (HEAD -> master,
 origin/master, origin/HEAD)

 houlei at houlei-PC:~/project/ffmpeg-source/ffmpeg-test$ ffmpeg -f x11grab
 -framerate 25 -video_size 1920*1080 -i :0.0 out.mp4
 ffmpeg version N-101185-g029e3c1c70 Copyright (c) 2000-2021 the FFmpeg
 developers
   built with gcc 8 (Uos 8.3.0.5-1+dde)
   configuration:
   libavutil      56. 65.100 / 56. 65.100
   libavcodec     58.124.100 / 58.124.100
   libavformat    58. 67.100 / 58. 67.100
   libavdevice    58. 12.100 / 58. 12.100
   libavfilter     7.107.100 /  7.107.100
   libswscale      5.  8.100 /  5.  8.100
   libswresample   3.  8.100 /  3.  8.100
 [x11grab @ 0x3aac380] Stream #0: not enough frames to estimate rate;
 consider increasing probesize
 Input #0, x11grab, from ':0.0':
   Duration: N/A, start: 1613791133.078335, bitrate: 1658880 kb/s
   Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080,
 1658880 kb/s, 25 fps, 1000k tbr, 1000k tbn, 1000k tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
 Press [q] to stop, [?] for help
 Output #0, mp4, to 'out.mp4':
   Metadata:
     encoder         : Lavf58.67.100
   Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive),
 1920x1080, q=2-31, 200 kb/s, 25 fps, 12800 tbn
     Metadata:
       encoder         : Lavc58.124.100 mpeg4
     Side data:
       cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
 frame=  301 fps= 25 q=24.8 size=    1536kB time=00:00:12.00
 bitrate=1048.6kbits/s speed=   1x

 When using ffmpeg to record screen, set the operating system time and set
 the system time backward. Stop screen recording, unable to save video.


 static int64_t wait_frame(AVFormatContext *s, AVPacket *pkt)
 {
     XCBGrabContext *c = s->priv_data;
     int64_t curtime, delay;

     c->time_frame += c->frame_duration;

     for (;;) {
         curtime = av_gettime();
         delay   = c->time_frame - curtime;
         if (delay <= 0)
             break;
         av_usleep(delay);
 //Here is the reason for the problem: because the user changes the
 operating system time, the delay time is too long, so the screen recording
 cannot be stopped.
     }

     return curtime;
 }

--
Ticket URL: <https://trac.ffmpeg.org/ticket/9089#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list