Thanks, David.
I installed the current release of ffmpeg on my Mac using Homebrew, and after some struggle I managed to get IDL to find the video libraries by creating the necessary symbolic links:
lrwxr-xr-x 1 root wheel 31B Feb 2 08:43 libavcodec.55.dylib@ -> /usr/local/lib/libavcodec.dylib
-rwxrwxr-x 1 root wheel 4.2M Jul 8 2015 libavcodec.55.dylib.original*
lrwxr-xr-x 1 root wheel 19B Jan 26 2017 libavcodec.dylib@ -> libavcodec.55.dylib
lrwxr-xr-x 1 root wheel 32B Feb 2 08:43 libavformat.55.dylib@ -> /usr/local/lib/libavformat.dylib
-rwxrwxr-x 1 root wheel 646K Jul 8 2015 libavformat.55.dylib.original*
lrwxr-xr-x 1 root wheel 20B Jan 26 2017 libavformat.dylib@ -> libavformat.55.dylib
lrwxr-xr-x 1 root wheel 30B Feb 2 08:44 libavutil.52.dylib@ -> /usr/local/lib/libavutil.dylib
-rwxrwxr-x 1 root wheel 258K Jul 8 2015 libavutil.52.dylib.original*
lrwxr-xr-x 1 root wheel 18B Jan 26 2017 libavutil.dylib@ -> libavutil.52.dylib
lrwxr-xr-x 1 root wheel 31B Feb 2 08:44 libswscale.2.dylib@ -> /usr/local/lib/libswscale.dylib
-rwxrwxr-x 1 root wheel 480K Jul 8 2015 libswscale.2.dylib.original*
lrwxr-xr-x 1 root wheel 18B Jan 26 2017 libswscale.dylib@ -> libswscale.2.dylib
I can see that IDL is using the newer versions of the ffmpeg libraries, but IDLffVideoWrite crashes when I try to create an output file.
IDL> video = IDLffVideoWrite('test.mp4')
% Loaded DLM: VIDEO.
IDL> result = video.GetCodecs(/LONG_NAMES, /VIDEO)
IDL> print, result
Multicolor charset for Commodore 64 Multicolor charset for Commodore 64, extended with 5th color (colram) Alias/Wavefront PIX image AMV Video
APNG (Animated Portable Network Graphics) image ASUS V1 ASUS V2 Avid 1:1 10-bit RGB Packer Avid Meridien Uncompressed
Uncompressed packed MS 4:4:4:4 BMP (Windows and OS/2 bitmap) Cinepak Cirrus Logic AccuPak VC3/DNxHD DPX (Digital Picture Exchange) image
DV (Digital Video) FFmpeg video codec #1 Huffyuv FFmpeg variant Flexible Image Transport System Flash Screen Video Flash Screen Video Version 2
FLV / Sorenson Spark / Sorenson H.263 (Flash Video) GIF (Graphics Interchange Format) H.261 H.263 / H.263-1996
H.263+ / H.263-1998 / H.263 version 2 Huffyuv / HuffYUV JPEG 2000 JPEG-LS Lossless JPEG MJPEG (Motion JPEG) MPEG-1 video MPEG-2 video
MPEG-4 part 2 MPEG-4 part 2 Microsoft variant version 2 MPEG-4 part 2 Microsoft variant version 3 Microsoft Video-1 PAM (Portable AnyMap) image
PBM (Portable BitMap) image PC Paintbrush PCX image PGM (Portable GrayMap) image PGMYUV (Portable GrayMap YUV) image
PNG (Portable Network Graphics) image PPM (Portable PixelMap) image Apple ProRes Apple ProRes Apple ProRes (iCodec Pro)
QuickTime Animation (RLE) video AJA Kona 10-bit RGB Codec Uncompressed RGB 10-bit raw video id RoQ video RealVideo 1.0 RealVideo 2.0 SGI image
Snow Sun Rasterfile image Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1 Truevision Targa image TIFF image Ut Video
Uncompressed 4:2:2 10-bit Uncompressed packed 4:4:4 Uncompressed packed QT 4:4:4:4 Uncompressed 4:4:4 10-bit SMPTE VC-2
AVFrame to AVPacket passthrough Windows Media Video 7 Windows Media Video 8 XBM (X BitMap) image X-face image XWD (X Window Dump) image
Uncompressed YUV 4:1:1 12-bit Uncompressed packed 4:2:0 LCL (LossLess Codec Library) ZLIB Zip Motion Blocks Video
libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB libxvidcore MPEG-4 part 2
VideoToolbox H.264 Encoder
IDL> .r mp4_animate
% Compiled module: MP4_ANIMATE.
IDL> MP4_ANIMATE
% Loaded DLM: PNG.
1540 300 6
dyld: lazy symbol binding failed: Symbol not found: _avcodec_alloc_frame
Referenced from: /Applications/exelis/idl85/bin/bin.darwin.x86_64/idl_video.so
Expected in: flat namespace
dyld: Symbol not found: _avcodec_alloc_frame
Referenced from: /Applications/exelis/idl85/bin/bin.darwin.x86_64/idl_video.so
Expected in: flat namespace
Abort trap: 6
IDL>
I switched the video libraries back to versions that come with IDL.
It is possible to use ffmpeg directly to make an .mp4 file, but a lossless-compression-file (-crf 0) will not play in QuickTime. The best I could do is -crf 1.
ffmpeg -r 6 -s 1540x300 -i m_frame_%04d.png -vcodec libx264 -crf 1 -pix_fmt yuv420p test.mp4
It is OK, but not great.
So far, the best quality that I have been able to achieve is to open the PNG files in QuickTime Player 7 Pro. Save it as a .mov file. Because it uses the PNG codec, that version is actually lossless, but most people don't have QT Player 7. If you open it in QuickTime Player 10, however, it converts the file using the Apple ProRes 4444 codec, which actually makes it *larger* and slightly fuzzy. Oh well, it looks like that is the best I can do.
It is too bad that there isn't a lossless video format (like PNG) that is simple and widely supported. But scientific animation is an infinitesimal market compared to movies.
Cheers, Ken