How to record video using Sphinx?

Hello. My name is Yoshi.
I am running a simulator called Sphinx on Ubuntu, and I would like to record videos.
I have checked the documentation, but I couldn’t find any configuration options for recording.
If it is possible to configure recording, please let me know how to do it.

Hello Yoshi,

It can be found in the documentation: Record and visualize cameras - 2.12.2

Thank you for your response, ocrave.
Based on reading the document, it seems that only still images (in PNG and HDR formats) can be saved.
I actually tried opening the web dashboard to confirm, and it appears that other file extensions cannot be selected.
Is it not possible to capture videos in formats like MP4?

The dashboard method is less efficient than the sphinx-cli method, so I recommend using sphinx-cli camera (first method).

Once you get your images in PNG format, you can use this python script to create an MP4 file with ffmpeg:

import glob
import os
import subprocess
import sys

if __name__ == '__main__':

    indir = sys.argv[1]  # path to png images
    outpath = sys.argv[2]  # path to mp4 file

    # rename all single frame files
    template = os.path.join(indir, 'frame_%08d.png')
    for idx, orig in enumerate(sorted(glob.glob(f'{indir}/*.png'))):
        dest = template % idx
        os.rename(orig, dest)

    # merge them into an mp4 file
    ffmpeg_cmd = f'''
        ffmpeg -y -i {template} \
                -c:v libx264 -profile:v high \
                -crf 20 \
                -pix_fmt yuv420p \
                -s 1280x720 \
                {outpath}
    '''
    process = subprocess.call(ffmpeg_cmd, shell=True, executable='/bin/bash')

Note that you can also use olympe to record video streams, but it will not work with special cameras:

https://developer.parrot.com/docs/olympe/userguide/advanced/streaming.html

Thank you for your prompt reply.
Also thank you for providing the Python script.

I am interested in developing a program to manipulate the video settings of Anafi.
So, I am looking for a way to check the videos for debugging purposes.
I would like to try the method you suggested using Olympe, as it would allow me to see a representation similar to the videos created by the actual drone.
Thank you very much for your kind instruction.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.