I am trying to convert a sequence of png images to a lossless video while upscaling (keeping the same aspect ratio). I have attached one png image
However, every lossless option I use either is obviously not lossless, or results in corrupted video.
I have tried
ffmpeg -framerate 60 -i %d.png -vf scale=-1:2160 -c:v libx264 -crf 0 -preset veryslow -c:a libmp3lame -b:a 320k output.mp4 I tried to add the cmd line output but this website complains my question is spam if I do and won't let me post it.
Which I think should be lossless due to the -crf 0, however doing this produces a corrupted video according to vlc, windows media player and firefox. However, chrome does manage to play it, but the results in this case are obviously lossy. Shown here, you can see very clearly thick concentric bands of colour that are not there in the actual .png, which instead falls off smoothly. Lossy Compression
I have tested this with both the full set of images that I want to make into a video, and just 3 frames so that I can be sure that there is nothing wrong with the input .png, in both cases the same results occur.
I have found after searching online that adding -pix_fmt yuv420p can help, so have tried this
ffmpeg -framerate 60 -i %d.png -vf scale=-1:2160 -c:v libx264 -crf 0 -preset veryslow -c:a libmp3lame -b:a 320k -pix_fmt yuv420p output.mp4
Doing so allows VLC to now open it (however firefox and windows media player still say it is corrupted). However, it is still obviously lossy compressed in both chrome and VLC.
I have then tried
ffmpeg -framerate 60 -i %d.png -vf scale=-1:2160 -c:v libvpx-vp9 -lossless 1 output.webm
Which I gather should be lossless due to -lossless 1 , however doing this results in a very weird output. In VLC and firefox, the output is just black. However in chrome, the output is mainly a green background that goes from dark green at the bottom of the screen to light green at the top, with a darker green circle in the middle, and the text in the top left has became pink. In windows media player, the output is similar however there is no dark green circle in the center, and the text in the top left has changed to a very bright light green and also been duplicated below itself in a lower resolution but bigger font and changed to a dark pink with a black outline.I don't understand how this could possibly happen
I have then tried adding -pix_fmt yuv420p to this as before,
ffmpeg -framerate 60 -i %d.png -vf scale=-1:2160 -c:v libvpx-vp9 -lossless 1 -pix_fmt yuv420p output.webm
When doing this, the output in VLC and firefox is still blank, however chrome and windows media player now show normal outputs, however the result is again obviously lossy compression.
I have then attempted ffmpeg -framerate 60 -i %d.png -vf scale=-1:2160 -c:v ffv1 -c:a libmp3lame -b:a 320k output.avi
However the output is just a blank black screen in VLC, freshly installed both on a windows 10 machine and ubuntu machine. The cmd output for this is
ffmpeg -framerate 60 -i %d.png -vf scale=-1:2160 -c:v ffv1 -c:a libmp3lame -b:a 320k output.avi
ffmpeg version N-91999-g148a21611d Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20180813
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 30.100 / 58. 30.100
libavformat 58. 18.102 / 58. 18.102
libavdevice 58. 4.103 / 58. 4.103
libavfilter 7. 32.100 / 7. 32.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
Input #0, image2, from '%d.png':
Duration: 00:00:10.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgb24(pc), 3840x1408, 60 fps, 60 tbr, 60 tbn, 60 tbc
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (output.avi) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream #0:0 -> #0:0 (png (native) -> ffv1 (native))
Press [q] to stop, [?] for help
Output #0, avi, to 'output.avi':
ISFT : Lavf58.18.102
Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), bgr0, 5891x2160, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
encoder : Lavc58.30.100 ffv1
frame= 600 fps=4.0 q=-0.0 Lsize= 100850kB time=00:00:10.00 bitrate=82616.4kbits/s speed=0.067x
video:100830kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.019776%
Attached is a link to the file output https://cernbox.cern.ch/index.php/s/ggEtDZmwxqzap3Y
How do I turn a sequence of png images into a losslessly compressed video?
Thank you for any help