I am using ffmpeg to convert a straight alpha .mov to a webm so I can layer videos on top of one another for a web game however when converted the duration is the right length but the frames freeze just before the end. I need the video to loop perfectly which the premult does but not the straight (videos at bottom - I apologies for the poor quality!)
When I use a premultiplied alpha of the exact same video is converts fine. I need the alpha to be straight so that there is no black line silhouetting the alpha so it comps together correctly! I am not sure what is causing the problem, I thought it might be a frames per second issue (using 24fps) but specifying it doesnt change anything for both of them!
This is the code I have been using in my terminal for both versions of the video (unmatted and matted):
ffmpeg -r 24 -i Desktop/INO_MOV/W2.mov -c:v libvpx-vp9 -strict -2 -crf 20 -b:v 0 -pix_fmt yuva420p -auto-alt-ref 0 -r 24 Desktop/INO_MOV/Walk_2.webm
This is what I get back from the premultiplied test video which works:
ffmpeg -r 24 -i Desktop/INO_MOV/W.mov -c:v libvpx-vp9 -strict -2 -crf 20 -b:v 0 -pix_fmt yuva420p -auto-alt-ref 0 -r 24 Desktop/INO_MOV/Walk_1.webm
ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Desktop/INO_MOV/W.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2017-08-10T09:51:13.000000Z
Duration: 00:00:02.50, start: 0.000000, bitrate: 209667 kb/s
Stream #0:0(eng): Video: qtrle (rle / 0x20656C72), bgra(progressive), 1280x720, 206312 kb/s, SAR 1:1 DAR 16:9, 24 fps, 24 tbr, 24 tbn, 24 tbc (default)
Metadata:
creation_time : 2017-08-10T09:51:13.000000Z
handler_name : Apple Alias Data Handler
encoder : Animation
timecode : 00:00:00:00
Stream #0:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2017-08-10T09:51:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream mapping:
Stream #0:0 -> #0:0 (qtrle (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x7fcce2803c00] v1.6.1
Output #0, webm, to 'Desktop/INO_MOV/Walk_1.webm':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
encoder : Lavf57.71.100
Stream #0:0(eng): Video: vp9 (libvpx-vp9), yuva420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 1k tbn, 24 tbc (default)
Metadata:
creation_time : 2017-08-10T09:51:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
encoder : Lavc57.89.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 60 fps=1.6 q=0.0 Lsize= 723kB time=00:00:02.45 bitrate=2407.5kbits/s speed=0.0657x
video:226kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 219.496933%
And this from the same video with a straight alpha (does work):
ffmpeg -r 24 -i Desktop/INO_MOV/W2.mov -c:v libvpx-vp9 -strict -2 -crf 20 -b:v 0 -pix_fmt yuva420p -auto-alt-ref 0 -r 24 Desktop/INO_MOV/Walk_2.webm
ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Desktop/INO_MOV/W2.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2017-08-10T09:54:51.000000Z
Duration: 00:00:02.50, start: 0.000000, bitrate: 209667 kb/s
Stream #0:0(eng): Video: qtrle (rle / 0x20656C72), bgra(progressive), 1280x720, 206312 kb/s, SAR 1:1 DAR 16:9, 24 fps, 24 tbr, 24 tbn, 24 tbc (default)
Metadata:
creation_time : 2017-08-10T09:54:51.000000Z
handler_name : Apple Alias Data Handler
encoder : Animation
timecode : 00:00:00:00
Stream #0:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2017-08-10T09:54:51.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream mapping:
Stream #0:0 -> #0:0 (qtrle (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x7ffba400e600] v1.6.1
Output #0, webm, to 'Desktop/INO_MOV/Walk_2.webm':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
encoder : Lavf57.71.100
Stream #0:0(eng): Video: vp9 (libvpx-vp9), yuva420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 1k tbn, 24 tbc (default)
Metadata:
creation_time : 2017-08-10T09:54:51.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
encoder : Lavc57.89.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 60 fps=0.7 q=0.0 Lsize= 5486kB time=00:00:02.00 bitrate=22460.5kbits/s speed=0.022x
video:5077kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.056586%
Thomass-iMac:~ thomasquemby$ ffmpeg -r 24 -i Desktop/INO_MOV/W2.mov -c:v libvpx-vp9 -strict -2 -crf 20 -b:v 0 -pix_fmt yuva420p -auto-alt-ref 0 -r 24 Desktop/INO_MOV/Walk_2.webm
Ive read through the code but I cant see whats going wrong? Is this just a bug with ffmpeg? Any help would be great!
Links to the videos:
Working Premult: https://www.dropbox.com/s/y3o9j9kl8ow3gfm/Walk_1.webm?dl=0
Not working Straight (ignore the discolouration): https://www.dropbox.com/s/pybe3cgxw2k8c48/Walk_2.webm?dl=0