5
$\begingroup$

This is my second question here. Recently I've been trying to compile a video simulation of wave propagation via ComplexPlot[] with Table[]. Essentially I produced a set of images with Table[] and then exported it as .avi. This would take upwards to 30 minutes to process but when all is set and done, I get a very very low quality, pixelated video and I wanted to ask if I could remedy this because the images from the Table[] seem very high res.

Here's my code for the plot and my Export settings

plot1 = Table[ComplexPlot[((1 - Abs[z]^2)/Abs[1 - z*Exp[-I*Pi/4]]^2)^((1 + I*4)/2)*Exp[-I*(1 + 4^2)*t], {z, -1 - I, 1 + 1 I}, PlotPoints -> 100, MaxRecursion -> 2, MeshFunctions -> Function[{z}, Abs[z]],Mesh -> {{0.9}}, MeshShading -> {Automatic, None}, ColorFunction -> {Automatic, None}, PlotLegends -> Automatic], {t,0, 2, 2/2000}];
`Export["hpw_2.avi", plot1, CompressionLevel -> 0, FrameRate -> 60, Antialiasing -> True, ImageResolution -> 500, ImageSize -> {1920, 1080}]

I've tried everything from increasing ImageResolution to increasing PlotPoints but both the plot as well as the legend turns out blurry.

Edit: It seems that I solved my problem by exporting in .mp4 format for quality as @Mariusz. Additionally, installing the full version of ffmeg as @Chris K mentioned has made computations much faster. Thank you!

$\endgroup$
4
  • 6
    $\begingroup$ avi format is very old use mp4.Try:Export["hpw_3.mp4", plot1, CompressionLevel -> 0, FrameRate -> 60, Antialiasing -> True, ImageSize -> {1920, 1080}] $\endgroup$ May 16, 2022 at 14:16
  • 2
    $\begingroup$ Recently, I also wanted to optimize some animated videos. As @MariuszIwaniuk noted, I found that mp4 was best. Furthermore, installing the full version of ffmpeg was well-worth the trouble, as the output was better and much smaller. See, e.g., this doc and this community post, and this M.SE post for more info. $\endgroup$
    – Chris K
    May 16, 2022 at 15:20
  • $\begingroup$ @ChrisK When I first started exporting video, mathematica asked me if I wanted to install ffmeg so I said yes. Now given that, should I also manually install ffmeg as suggested by the doc you mentioned? $\endgroup$
    – deedeefive
    May 16, 2022 at 17:13
  • 1
    $\begingroup$ @dd5 I’d give it a try - it was a minor pain but ultimately worth it. The community post I linked shows how to tell if you have the full version or not. $\endgroup$
    – Chris K
    May 16, 2022 at 18:04

1 Answer 1

1
$\begingroup$

If you want to generate a video directly and save memory and time, you could also try something like

Parallelize@
 AnimationVideo[
  Rasterize@
   ComplexPlot[((1 - Abs[z]^2)/Abs[1 - z*Exp[-I*Pi/4]]^2)^((1 + I*4)/
        2)*Exp[-I*(1 + 4^2)*t], {z, -1 - I, 1 + 1 I}, 
    PlotPoints -> 100, MaxRecursion -> 2, 
    MeshFunctions -> Function[{z}, Abs[z]], Mesh -> {{0.9}}, 
    MeshShading -> {Automatic, None}, 
    ColorFunction -> {Automatic, None}, PlotLegends -> Automatic, 
    ImageSize -> {1920, 1080}],
  {t, 0, 2},
  CompressionLevel -> 0, FrameRate -> 60, DefaultDuration -> 30,
  GeneratedAssetLocation -> "vid.mp4"
  ]
$\endgroup$
1
  • $\begingroup$ Nice, BTW, that took my computer about 4 hours to do. $\endgroup$ Dec 13, 2022 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.