Skip to content

Commit

Permalink
try writing stream directly
Browse files Browse the repository at this point in the history
  • Loading branch information
landmanbester committed Apr 11, 2024
1 parent 2d2dbab commit 5f8670a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
10 changes: 10 additions & 0 deletions pfb/parser/smoovie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ inputs:
default: true
info:
Whether to allow averaging across scan boundaries
out-format:
dtype: str
default: gif
choices:
- gif
- mp4
info:
The format to write movie out in.
gifs are usually better quality but can get quite large.
mp4 quality not currently great with streamjoy.

outputs:
{}
20 changes: 15 additions & 5 deletions pfb/workers/smoovie.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,28 @@ def plot_frame(frame):
# 5 - band id

# TODO - submit streams in parallel
idfy = f'fps{opts.fps}_tbin{opts.time_bin}_fbin{opts.freq_bin}'
if opts.out_format.lower() == 'gif':
uri = f'{opts.outname}_band{b}_{idfy}.gif'
elif opts.out_format.lower() == 'mp4':
uri = f'{opts.outname}_band{b}_{idfy}.mp4'
else:
raise ValueError(f"Unsupported format {opts.out_format}")

# TODO - progressbar
outim = stream(
results,
renderer=plot_frame,
intro_title=f"{opts.outname}-Band{b:04d}",
optimize=True,
threads_per_worker=1
# uri=f'{opts.outname}.band{b:0:4d}.mp4'
threads_per_worker=1,
fps=opts.fps,
uri=uri
)

outim.fps = opts.fps
outim.write(f'{opts.outname}_band{b}_fps{opts.fps}_tbin'
f'{opts.time_bin}_fbin{opts.freq_bin}.gif')
# outim.fps = opts.fps
# outim.write(f'{opts.outname}_band{b}_fps{opts.fps}_tbin'
# f'{opts.time_bin}_fbin{opts.freq_bin}.gif')


elif opts.animate_axis == 'freq':
Expand Down

0 comments on commit 5f8670a

Please sign in to comment.