Recherche avancée

Médias (0)

Mot : - Tags -/diogene

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (65)

Sur d’autres sites (12251)

  • Frame size difference before and after creating a video

    31 mars 2020, par tkhan

    I am creating a video from images using Opencv.

    



    dim=(width, height)
fourcc = cv2.VideoWriter_fourcc(*'X264')
out_d = cv2.VideoWriter(save_path_depth,fourcc, fps, dim)


    



    After creating video I read video and extract frames from that video

    



    while(cap.isOpened()):
    ret, frame = cap.read()

    if ret == False:
        break
    print(frame)
    cv2.imwrite(output+"/"+ str(i).zfill(1) + ".png", frame)      
    i+=1

cap.release()


    



    Frame size is almost double than size of frame i initially used to create the video. Other than that when i do frame to frame comparison, some frames are completely different than their counterpart original frames. Can somebody explain what can be the reason behind it.

    


  • Accord.Video.FFMpeg : Problem of duration difference between recording time and video time

    5 mars 2020, par ckrby

    I want to save the footage I get from the webcam as a video in webM (Vp8) format. I use the Accord library. But when recording, there is almost 2-3 times the difference between the time spent and the video time. The code I use and some debug outputs are below.

    Accord.Video.FFMpeg 3.8.2-Alpha (double pts/dts bug fixed version)
    Video Save Format : VP8 (.WebM)

    Record Start Settings :

    videoCodec = VideoCodec.Vp8;    
    bitrate : 1250000  
    framerate :10  
    height :720
    width: 1280
    videoSource.VideoResolution: 1280x720, 30 fps (30 max fps), 24 bpp  
    FileWriter.BitRate = bitRate;  
    FileWriter.FrameRate = new Accord.Math.Rational((int)framerate );  
    FileWriter.Width = width;  
    FileWriter.Height = height;
    FileWriter.VideoCodec = videoCodec;
    FileWriter.Open(FileName);  
    _recording = true;  
    StartTimeStamp = DateTime.Now;  

    newFrame Event

    private void VideoSourcePlayer1_NewFrame(object sender, ref Bitmap image)
    {
       if (_recording)
       {
           try
           {
               Bitmap CurrentBitmap = image;
               DateTime CurrentTimeStamp = DateTime.Now;
               TimeSpan CurrentTimeSpan = StartTimeStamp - CurrentTimeStamp;
               Console.WriteLine("Video Write Timespan: " + CurrentTimeSpan.ToString());
               FileWriter.WriteVideoFrame(CurrentBitmap, CurrentTimeSpan);
               // FileWriter.WriteVideoFrame(image);  
           }
           catch (Exception ex)
           {
               Console.WriteLine("VideoSourcePlayer1_NewFrame catch: " + ex.Message);
           }
       }
    }

    Note : It is the same issue with timespan or without timespan writing.

    In the 122 second (02.02 min) period, 50 seconds of video recording is created. I couldn’t solve it.

    Little Part of the debug output :

    Video Write Timespan : -00:01:55.4107365
    pts:4,730000e+004 pts_time:47,3 dts:4,730000e+004 dts_time:47,3 duration:1,000000e+002 duration_time:0,1
    Video Write Timespan : -00:01:55.6136263
    pts:4,740000e+004 pts_time:47,4 dts:4,740000e+004 dts_time:47,4 duration:1,000000e+002 duration_time:0,1
    Video Write Timespan : -00:01:55.8354960
    pts:4,750000e+004 pts_time:47,5 dts:4,750000e+004 dts_time:47,5 duration:1,000000e+002 duration_time:0,1
    Video Write Timespan : -00:01:56.5161088
    pts:4,760000e+004 pts_time:47,6 dts:4,760000e+004 dts_time:47,6 duration:1,000000e+002 duration_time:0,1
    Video Write Timespan : -00:01:56.7309841
    pts:4,770000e+004 pts_time:47,7 dts:4,770000e+004 dts_time:47,7 duration:1,000000e+002 duration_time:0,1
    Video Write Timespan : -00:01:56.9758413
    pts:4,780000e+004 pts_time:47,8 dts:4,780000e+004 dts_time:47,8 duration:1,000000e+002 duration_time:0,1
    Video Write Timespan : -00:01:57.1947200
    pts:4,790000e+004 pts_time:47,9 dts:4,790000e+004 dts_time:47,9 duration:1,000000e+002 duration_time:0,1
    Video Write Timespan : -00:01:57.4375834
    pts:4,800000e+004 pts_time:48 dts:4,800000e+004 dts_time:48 duration:1,000000e+002 duration_time:0,1
    Video Write Timespan : -00:01:57.5804983

    The last two outputs :

    Video Write Timespan : -00:02:02.7505463
    pts:5,000000e+004 pts_time : 50 dts:5,000000e+004 dts_time : 50 duration:1,000000e+002 duration_time:0,1
    Video Write Timespan : -00:02:02.9884038
    pts:5,010000e+004 pts_time : 50,1 dts:5,010000e+004 dts_time : 50,1 duration:1,000000e+002 duration_time:0,1

    Why is there a difference between timespan and dts/pts time ? Could the problem be due to this ?

    Note : When I set the framerate to 30 ; Another process 95 seconds (1.35 min) recording time is 16 seconds in the video.

    As the frame rate increases, the length of the video gets shorter and
    shorter than the actual value it should be.

    Output :

    Video Write Timespan : -00:01:35.1086178
    pts:1,606700e+004 pts_time : 16,067 dts:1,606700e+004 dts_time : 16,067 duration:3,300000e+001 duration_time:0,033
    Video Write Timespan : -00:01:35.2565302
    pts:1,610000e+004 pts_time : 16,1 dts:1,610000e+004 dts_time : 16,1 duration:3,300000e+001 duration_time:0,033
    Video Write Timespan : -00:01:35.3984494
    pts:1,613300e+004 pts_time : 16,133 dts:1,613300e+004 dts_time : 16,133 duration:3,300000e+001 duration_time:0,033

    So the video duration is like dts_time. Why is the video duration not
    value of timespan time, I still can’t find it ??

    Soory for my bad english & expression,

  • What difference does it make which version of Mozilla, MacOS and Safari we specify for using ffmpeg ?

    3 mars 2020, par Kaizer Sozay

    I came across this snippet of code for downloading m3u8 playlists and concatenating them into an mkv file :

    $ ffmpeg -user_agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/601.7.8 (KHTML, like Gecko) Version/9.1.3 Safari/537.86.7" -i https://devstreaming-cdn.apple.com/videos/wwdc/2019/901myoscpux9y7nry55/901/hls_vod_mvp.m3u8 -c copy pd.mkv

    My question is about the section of the script :

    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/601.7.8 (KHTML, like Gecko) Version/9.1.3 Safari/537.86.7"

    These seem like very old numbers. For example, Catalina is 10.15.3. No idea which is the latest Mozilla but Safari is now on 13.0.5

    Was just wondering if it makes any difference if the version is old, or if we should update to the code to specify newer versions of Mac OS, Mozilla, Webkit and Safari.

    Can someone explain the significance ?