Video flythrough of a pointcloud

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Video flythrough of a pointcloud

Bart Verhagen
Hello,

We're trying to make a video flythrough of a pointcloud using pclvisualizer.

What we're doing is updating the camera position, then save a frame, then update the camera position ...

This way we get a lot of png files, which can then be fed to ffmpeg for processing. The individual png's look fine, but we have issues with the video:

- the bitrate of the video is extremely high (I guess because the encoder fails to make deltas between the successive frames)

- the video doesn't appear fluent and there is flicker (when using melt to step thru the individual frames, the frames look okay)

On youtube there are many examples of fluent point cloud videos (eg radiohead house of cards videoclip). I wonder if anybody knows the secret in here.

Currently I am using the following commands for converting the saved frames into a H264 video (the frames are Full HD png's named 'ssht-ddddd.png' where 'd' is a frame number digit):
    $ ffmpeg -r 120 -f image2 -s 1920x1080 -i ssht-%05d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4
    $ ffmpeg -y -i test.mp4 -r 30 -s 1920x1080 -c:v libx264 -strict -2 -movflags faststart down_sampled.mp4

This results in a 25 FPS H264 Full HD video with a bit rate of 70.6 Mb/s.

Bart

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Video flythrough of a pointcloud

Sérgio Agostinho
In case you haven't done it yet, it might be a good idea to post this to
the ffmpeg mailing list, especially since you indicate that when going
through the individual frames they look just fine.

Cheers




_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Video flythrough of a pointcloud

Stephen McDowell
Here is a note i made to myself a long time ago that i barely understand now, but may be helpful.  Setting the frame rate is important.  I’m pretty sure i scrapped it together based off a number of different resources.  The OpenGL stuff is assuming you’re downloading a texture from the GPU or something (I think i was using a frame buffer), so it shouldn’t be too relevant.

However, I think one thing that may be relevant is not having an alpha channel?  I hope it is useful, but i sent this note to myself more than two years ago and clearly didn’t do a very good job making it a useful note…



static unsigned long FRAME = 0;
    char buffer [50];
    int n=sprintf (buffer, "%lu", FRAME);
    cv::Mat img(height, width, CV_8UC3);
    //use fast 4-byte alignment (default anyway) if possible
    glPixelStorei(GL_PACK_ALIGNMENT, (img.step & 3) ? 1 : 4);
    //set length of one complete row in destination data (doesn't need to equal img.cols)
    glPixelStorei(GL_PACK_ROW_LENGTH, img.step/img.elemSize());
    glReadPixels(0, 0, img.cols, img.rows, GL_BGR, GL_UNSIGNED_BYTE, img.data);
    cv::Mat flipped(height, width, CV_8UC3);
    cv::flip(img, flipped, 0);
    std::string meh = "exports/" + std::string(buffer) + "_data_export.png";
    cv::imwrite( meh , flipped );
    FRAME++;



ALSO

use ffmpeg

ffmpeg -y -f image2 -framerate 33 -i %d_data_export.png -q:v 2 -r 33 MEIN.mp4





_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users