Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to Rotate TIMELAPSE #139

Open
TheVoronModder opened this issue Oct 24, 2023 · 4 comments
Open

Need to Rotate TIMELAPSE #139

TheVoronModder opened this issue Oct 24, 2023 · 4 comments

Comments

@TheVoronModder
Copy link

I have a ArduCam 518, I set the camera to the correct rotation 180° so its right side up, the camera is installed upside down FYI.

I cannot find a way to get the timelapse to be upright all the videos are upside down....

How do I fix this?

@skyeshadow94
Copy link

skyeshadow94 commented Oct 25, 2023

On Mainsail it is under the webcams setting interface for me atleast

@arcadien
Copy link

arcadien commented Jun 8, 2024

Hello, in mainsail the webcam view is ok, but the timelapse is not rotated.
Moonraker log seems to trace correct commands, including -vf 'hflip,vflip'

[...]
1766 2024-06-08 20:57:20,073 [shell_command.py:_check_proc_success()] - Command (wget http://127.0.0.1:8080/snapshot -O /tmp/timelapse/frame000494.jpg) successfully finished
2024-06-08 20:57:36,066 [timelapse.py:render()] - start FFMPEG: /usr/bin/ffmpeg -r 30 -i '/tmp/timelapse/frame%6d.jpg' -vf 'hflip,vflip' -threads 2 -g 5 -crf 23 -vcodec libx264 -pix_fmt yuv420p -an  '/tmp/timelapse/timelapse_Cam and light support(2)_PLA_2h58m.gcode_20240608_2057.mp4' -y
2024-06-08 21:01:40,282 [timelapse.py:render()] - Rotate preview image cmd: /usr/bin/ffmpeg -i '/home/pi/timelapse/timelapse_Cam and light support(2)_PLA_2h58m.gcode_20240608_2057.jpg' -vf 'hflip,vflip' -an  '/home/pi/timelapse/timelapse_Cam and light support(2)_PLA_2h58m.gcode_20240608_2057.jpg' -y

timelapse_Cam and light support(2)_PLA_2h58m gcode_20240608_2057

@arcadien
Copy link

arcadien commented Jun 8, 2024

After some more investigation. When webcam are configured to be rotated in Mainsail, the frames are captured rotated (as in Mainsail views). If ffmpeg rotates again frames, then they are back to bad format.
It means flips should not be done again if already set in the mainsail config (not mainsail-timelapse config)

Trying:

@ component/timelapse.py:676 @ class Timelapse:
                pi = 3.141592653589793
                rot = str(self.config['rotation']*(pi/180))
                filterParam = " -vf 'rotate=" + rot + "'"
           - elif self.config['flip_x'] and self.config['flip_y']:
           -     filterParam = " -vf 'hflip,vflip'"
           - elif self.config['flip_x']:
           -     filterParam = " -vf 'hflip'"
           - elif self.config['flip_y']:
           -     filterParam = " -vf 'vflip'"
           + # elif self.config['flip_x'] and self.config['flip_y']:
           + #     filterParam = " -vf 'hflip,vflip'"
           + # elif self.config['flip_x']:
           + #     filterParam = " -vf 'hflip'"
           + # elif self.config['flip_y']:
           + #     filterParam = " -vf 'vflip'"

            # build shell command
            cmd = self.ffmpeg_binary_path \

@arcadien
Copy link

arcadien commented Jun 9, 2024

After some more investigation. I have two cameras. First one is not rotated (std webcam) the second is (Raspberry cam).
The rotation param seems to apply to both when using timelapse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants