Jump to content

Recommended Posts

Posted

Hi folks,

I thought it useful to convert a video file into an image sequence for stacking. Can this be done with Affinity Photo 1 or 2?  I am using a Mac and interested in astro applications.  Thanks and regards

Posted

You can try playing the video, pausing and taking screenshots (at whatever interval you require), then use those screenshots for stacking in Affinity

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Posted

Some of the astrophotography/video experts in the forums might be able to give you advice on the best way to get the stills from the video in a format that will work well with Affinity Photo.

They will probably need to know more details about the original video before they can do that: File format; equipment used; coding information, etc.
(I don’t work with video so I don’t know what they would need, so give as much detail as you can – the more they know the better they can help.)

Then someone can probably give you advice with the stacking process in Photo, but you will need to get the stills first so they can see what you are working with.

Posted
42 minutes ago, irandar said:

I am using a Mac

If you have an older macOS: In Apple's QuickTime 7 you can export as Image Sequence and limit the number of images by a frame rate. I can't tell if this feature is accessible without a license key, as I don't know if they still sell those.

QT7.jpg.f7d89a48213f8f34f52bb1bcaaac9af3.jpg

• MacBookPro Retina 15" |  macOS 10.14.6  | Eizo 27" | Affinity V1  
• iPad 10.Gen.  |  iOS 18.5.  |  Affinity V2.6

Posted
2 hours ago, irandar said:

I have seen how to get individual still frames. Can you suggest software to do a whole sequence?

Well there are probably a bunch of video creation and video editing related software which can and offer to do so in some comfortable manner

However, I for my task once had a similar demand for somthing like that and used therefor some Python scripting (...no surprise here, as py allows quick turnarounds and protypings etc.) in order to extract single PNG images from mp4 files.

So a Python3 script like this one here, which (re)uses a MoviePy Python module, can be used to extract a sequence of PNGs by passing over a list of times to extract the frames from some given mp4 file. - The script is simple and looks like this ...

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Get image sequences from video
#
# Usage in shell:  python3 img_from_video.py -v/--video file.mp4
#
# Provided by v_kyr
# Freely reusable.
#
import argparse
from moviepy.editor import VideoFileClip
import os

def extract_frames(movie, times, imgdir):
	if not os.path.exists(imgdir):
		os.makedirs(imgdir)

	clip = VideoFileClip(movie)
	for t in times:
		imgpath = os.path.join(imgdir, '{}.png'.format(int(t * clip.fps)))
		print('...')
		clip.save_frame(imgpath, t)

# Create an  argument parser
parser = argparse.ArgumentParser()
# Add an argument
parser.add_argument('-v', '--video', type=str, required=True)
# Parse the argument
args = parser.parse_args()
movie = args.video
imgdir = './pngs'
clip = VideoFileClip(movie)
times = [i/clip.fps for i in range(int(clip.fps * clip.duration))]
# print(times)
extract_frames(movie, times, imgdir)

One would call that py script via a cmdline shell the following way ...

Quote

> python3 img_from_video.py -v file.mp4
... or ...

> python3 img_from_video.py --video file.mp4

So an example run with passing over this sierpinski.mp4 video file ...

... by calling ...

Quote

> python3 img_from_video.py -v sierpinski.mp4

... would use the following list of internal determined times frames from that sierpinski.mp4 video ...

Quote

[0.0, 0.04, 0.08, 0.12, 0.16, 0.2, 0.24, 0.28, 0.32, 0.36, 0.4, 0.44, 0.48, 0.52, 0.56, 0.6, 0.64, 0.68, 0.72, 0.76, 0.8, 0.84, 0.88, 0.92, 0.96, 1.0, 1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52, 1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2.0, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3.0, 3.04, 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32, 3.36, 3.4, 3.44, 3.48, 3.52, 3.56, 3.6, 3.64, 3.68, 3.72, 3.76, 3.8, 3.84, 3.88, 3.92, 3.96, 4.0, 4.04, 4.08, 4.12, 4.16, 4.2, 4.24, 4.28, 4.32, 4.36, 4.4, 4.44, 4.48, 4.52, 4.56, 4.6, 4.64, 4.68, 4.72, 4.76, 4.8, 4.84, 4.88, 4.92, 4.96, 5.0, 5.04, 5.08, 5.12, 5.16, 5.2, 5.24, 5.28, 5.32, 5.36, 5.4, 5.44, 5.48, 5.52, 5.56, 5.6, 5.64, 5.68, 5.72, 5.76, 5.8, 5.84, 5.88, 5.92, 5.96, 6.0, 6.04, 6.08, 6.12, 6.16, 6.2, 6.24, 6.28, 6.32, 6.36, 6.4, 6.44, 6.48, 6.52, 6.56, 6.6, 6.64, 6.68, 6.72, 6.76, 6.8, 6.84, 6.88, 6.92, 6.96, 7.0, 7.04, 7.08, 7.12, 7.16, 7.2, 7.24, 7.28, 7.32, 7.36, 7.4, 7.44, 7.48, 7.52, 7.56, 7.6, 7.64, 7.68, 7.72, 7.76, 7.8, 7.84, 7.88, 7.92, 7.96, 8.0, 8.04, 8.08, 8.12, 8.16, 8.2, 8.24, 8.28, 8.32, 8.36, 8.4, 8.44, 8.48, 8.52, 8.56, 8.6, 8.64, 8.68, 8.72, 8.76, 8.8, 8.84, 8.88, 8.92, 8.96, 9.0, 9.04, 9.08, 9.12, 9.16, 9.2, 9.24, 9.28, 9.32, 9.36, 9.4, 9.44, 9.48, 9.52, 9.56, 9.6, 9.64, 9.68, 9.72, 9.76, 9.8, 9.84, 9.88, 9.92, 9.96, 10.0, 10.04, 10.08, 10.12, 10.16, 10.2, 10.24, 10.28, 10.32, 10.36, 10.4, 10.44, 10.48, 10.52, 10.56, 10.6, 10.64, 10.68, 10.72, 10.76, 10.8, 10.84, 10.88, 10.92, 10.96, 11.0, 11.04, 11.08, 11.12, 11.16, 11.2, 11.24, 11.28, 11.32, 11.36, 11.4, 11.44, 11.48, 11.52, 11.56, 11.6, 11.64, 11.68, 11.72, 11.76, 11.8, 11.84, 11.88, 11.92, 11.96, 12.0]

... and when running produce a ./pngs directory (under the actual directory the script is started from) which contains a bunch of PNG files from that video.

Quote

> ls ./pngs/
0.png   118.png 137.png 156.png 175.png 194.png 216.png 239.png 260.png 28.png  3.png   48.png  68.png  87.png
1.png   119.png 138.png 157.png 176.png 195.png 217.png 24.png  261.png 280.png 30.png  49.png  69.png  88.png
10.png  12.png  139.png 158.png 177.png 196.png 218.png 240.png 262.png 281.png 300.png 5.png   7.png   89.png
100.png 120.png 14.png  159.png 178.png 197.png 219.png 241.png 263.png 282.png 31.png  50.png  70.png  9.png
101.png 121.png 140.png 16.png  179.png 198.png 22.png  242.png 264.png 283.png 32.png  51.png  71.png  90.png
102.png 122.png 141.png 160.png 18.png  199.png 220.png 243.png 265.png 284.png 33.png  52.png  72.png  91.png
103.png 123.png 142.png 161.png 180.png 2.png   221.png 244.png 266.png 285.png 34.png  53.png  73.png  92.png
104.png 124.png 143.png 162.png 181.png 20.png  222.png 245.png 267.png 286.png 35.png  54.png  74.png  93.png
105.png 125.png 144.png 163.png 182.png 200.png 223.png 246.png 268.png 287.png 36.png  55.png  75.png  94.png
106.png 126.png 145.png 164.png 183.png 202.png 224.png 247.png 269.png 288.png 37.png  56.png  76.png  95.png
107.png 127.png 146.png 165.png 184.png 204.png 225.png 248.png 27.png  289.png 38.png  57.png  77.png  96.png
108.png 128.png 147.png 166.png 185.png 206.png 227.png 249.png 270.png 290.png 39.png  59.png  78.png  97.png
109.png 129.png 148.png 167.png 186.png 208.png 229.png 25.png  271.png 291.png 4.png   6.png   79.png  98.png
11.png  13.png  149.png 168.png 187.png 209.png 23.png  250.png 272.png 292.png 40.png  60.png  8.png   99.png
110.png 130.png 15.png  169.png 188.png 21.png  231.png 252.png 273.png 293.png 41.png  61.png  80.png
111.png 131.png 150.png 17.png  189.png 210.png 233.png 254.png 274.png 294.png 42.png  62.png  81.png
112.png 132.png 151.png 170.png 19.png  211.png 234.png 256.png 275.png 295.png 43.png  63.png  82.png
113.png 133.png 152.png 171.png 190.png 212.png 235.png 257.png 276.png 296.png 44.png  64.png  83.png
114.png 134.png 153.png 172.png 191.png 213.png 236.png 258.png 277.png 297.png 45.png  65.png  84.png
115.png 135.png 154.png 173.png 192.png 214.png 237.png 259.png 278.png 298.png 46.png  66.png  85.png
117.png 136.png 155.png 174.png 193.png 215.png 238.png 26.png  279.png 299.png 47.png  67.png  86.png

NOTE: of course that initially simple script could be customized accordingly to own demands here, so for example to also pass via arguments instead a list of only specific times for the PNG files to extract ... etc.

 

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Posted
2 hours ago, irandar said:

 I have seen how to get individual still frames. Can you suggest software to do a whole sequence? Thanks and regards

The best video editing software that I know of where you can export a video as an image sequence is FXHome's Hitfilm It is available for free from FXHome's website.

Posted

Ffmpeg can do this on any platform out of the box. It’s free software.

i used it a lot on PC, you just need to google a bit for parameters, specifically handling of special characters like „“ and % may vary on PC vs Linux / Mac

ffmpeg -i "C:\Applications\FFMPEG\aa.mp4" "frames/out-%03d.jpg"

and you may need to add a quality parameter to get full size/quality jpg images.

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted
13 hours ago, NotMyFault said:

Ffmpeg can do this on any platform out of the box. It’s free software.

That is also used internally in the Python MoviePy module, among other tools.

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Posted
On 7/21/2023 at 10:27 PM, NotMyFault said:

Ffmpeg (…) out of the box.

Any idea why the Terminal appears not to know it? – A download of ffmpeg results in a "Ausführbare Datei" + UNIX thumbnail.

If I drag it into a Terminal window … then neither 'man' nor '-h' seem to work:

ffmpegterminaldrag.jpg.895083f406a9a9c0903e63900ba5792c.jpg  ffmpeg-h.jpg.4db32b1853f1521c521823f76b23b8e0.jpg

If I open it (double click) it ends with but no end: I can't enter anything.
ffmpegterminalopen.jpg.101d6f156170380904ce91408e75d11e.jpg

• MacBookPro Retina 15" |  macOS 10.14.6  | Eizo 27" | Affinity V1  
• iPad 10.Gen.  |  iOS 18.5.  |  Affinity V2.6

Posted
1 hour ago, thomaso said:

Any idea why the Terminal appears not to know it? – A download of ffmpeg results in a "Ausführbare Datei" + UNIX thumbnail.

If I drag it into a Terminal window … then neither 'man' nor '-h' seem to work

Depends on how you downloaded, build and installed it! - Other than that, the ffmpeg online docs are here!

Quote

## Documentation

The offline documentation is available in the **doc/** directory.

The online documentation is available in the main [website](https://ffmpeg.org)
and in the [wiki](https://trac.ffmpeg.org).

 

BTW, man pages are either way only available for library functions (aka man 3 pages)!

Quote
MANUAL SECTIONS
    The standard sections of the manual include:

    1      User Commands
    2      System Calls
    3      C Library Functions
    4      Devices and Special Files
    5      File Formats and Conventions
    6      Games et. al.
    7      Miscellanea
    8      System Administration tools and Daemons

    Distributions customize the manual section to their specifics,
    which often include additional sections.

If you just downloaded binaries (let's say from evermeet here), then you don't have any docs or man "Unix manual pages" for it, as the 7z files there usually only contain the macOS binaries. For a single binary, copy or move that into the "usr/local/bin" directory ...

Quote

> mv ./ffmpeg /usr/local/bin

> ll /usr/local/bin/ffm*   (where ll is an alias for ls -l in my shell)
-rwxr-xr-x  1 vkyr  staff  78829164 Feb 28 03:33 /usr/local/bin/ffmpeg

> which ffmpeg                                                                                                                                                                    
/usr/local/bin/ffmpeg

> ffmpeg -h                                                                                                                                                                       
ffmpeg version 6.0-tessus  https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2023 the FFmpeg developers                                                                             
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)                                                                                                                      
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbl
uray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --ena
ble-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-l
ibtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --en
able-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay                                                     
  libavutil      58.  2.100 / 58.  2.100                                                                                                                                          
  libavcodec     60.  3.100 / 60.  3.100                                                                                                                                          
  libavformat    60.  3.100 / 60.  3.100                                                                                                                                          
  libavdevice    60.  1.100 / 60.  1.100                                                                                                                                          
  libavfilter     9.  3.100 /  9.  3.100                                                                                                                                          
  libswscale      7.  1.100 /  7.  1.100                                                                                                                                          
  libswresample   4. 10.100 /  4. 10.100                                                                                                                                          
  libpostproc    57.  1.100 / 57.  1.100                                                                                                                                          
Hyper fast Audio and Video encoder                                                                                                                                                
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...                                                                                            
                                                                                                                                                                                  
Getting help:                                                                                                                                                                     
    -h      -- print basic options                                                                                                                                                
    -h long -- print more options                                                                                                                                                 
    -h full -- print all options (including all format and codec specific options, very long)                                                                                     
    -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol                                                                             
    See man ffmpeg for detailed description of the options.                                                                                                                       
                                                                                                                                                                                  
Print help / information / capabilities:                                                                                                                                          
-L                  show license                                                                                                                                                  
-h topic            show help                                                                                                                                                     
-? topic            show help                                                                                                                                                     
-help topic         show help                                                                                                                                                     
--help topic        show help                                                                                                                                                     
-version            show version
...
...
...                      

 

1 hour ago, thomaso said:

If I open it (double click) it ends with but no end: I can't enter anything.

Instead open the Terminal.app or even better use iTerm2.app and ...

  • if "ffmpeg" resides under "/usr/local/bin" then type in "ffmpeg -h".
  • Otherwise for any directory not in PATH go via the shell into the directory the binary resides in (with cd)  and type in "./ffmpeg -h"

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Posted
On 7/21/2023 at 5:52 PM, v_kyr said:

NOTE: of course that initially simple script could be customized accordingly to own demands here ...

frontend.jpg.a18713b17be06289b77c84c8b187a365.jpg

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Posted
6 minutes ago, irandar said:

Thanks for all the replies. It seems that VLC is a free and simple method. Best to all

If you mean in context of Adapter which anto referenced to, that needs & (re)uses FFmpeg and VLC Media Player installments. - See therefor also ...

 

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Posted

Yes I see that. Maybe my Mac is too new. 12 something. I will sort it out.  I wonder if Affinity is not thinking about making the astro part video compatible. 

Thanks

Posted
6 hours ago, irandar said:

Maybe my Mac is too new. 12 something. I will sort it out. 

If it's an Intel CPU based one it should still work, even with newer macOS versions. For an ARM based (Mx) Mac then, instead Rosetta 2 will probably have to kick in for executing the Adapter code!

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.