Closed JayPrice1 closed 6 months ago
This error seems to appear because the width of your export resolution is set to an odd number. You should be able to “fix” this error by setting the export width to an even value like 1066 or 1068.
Since this appears to be a limitation of the H.264 codec used in the MP4 format, we should definitely update the export dialog to make that restriction more apparent and ensure invalid values can’t be selected.
Hmm so resolutions has to be divisible by 2, well that's good to know. Yes we should definitely enforce that!
Hmm so resolutions has to be divisible by 2, well that's good to know. Yes we should definitely enforce that!
@CandyFace @J5lx I believe this is a limitation of the H.264 codec itself. Not a general limitation per se according to this comment: https://trac.ffmpeg.org/ticket/309#comment:4
Found this filter parameter check for ffmpeg on SO to provide some ideas https://stackoverflow.com/questions/20847674/ffmpeg-libx264-height-not-divisible-by-2
However it could be better to warn the user to avoid non-standard resolutions in Pencil2D. That said people that create non-standard output, like vertical ads for stadiums as mentioned here https://www.reddit.com/r/editors/comments/255bvb/h264_resolution_limits_and_some_strange_led_specs/ don't seem to use H.264 at all, rather just Uncompressed AVI's
@JayPrice1 By default you are exporting MP4 with H264 codec. This doesn't like sizes that aren't divisible by 2.
Can you please attempt to export a movie in AVI format? Go to File > Export > Movie > Browse > Click on the format dropdown list and select AVI. Please let us know if it fails or not as well so we can incorporate this information into the ticket. Thanks.
Thank you so much for the quick reply. That worked!
Jay
On Thu, Oct 29, 2020 at 2:13 AM Jakob Gahde notifications@github.com wrote:
This error seems to be appear because the width of your export resolution is set to an odd number. You should be able to “fix” this error by setting the export width to an even value like 1066 or 1068.
Since this appears to be a limitation of the H.264 codec used in the MP4 format, we should definitely update the export dialog to make that restriction more apparent and ensure invalid values can’t be selected.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pencil2d/pencil/issues/1491#issuecomment-718518890, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARRZDIH3BWUJKJFXOXPVST3SNEW4VANCNFSM4TDLBZVQ .
So - If users insist that they want special resolutions, they can/must use AVI. I guess we still must have a check, that stops MP4 exports from using uneven numbers?
I exported with AVI with an odd resolution and it worked....
On Thu, Oct 29, 2020 at 10:56 AM Morr notifications@github.com wrote:
@JayPrice1 https://github.com/JayPrice1 By default you are exporting MP4 with H264 codec. This doesn't like sizes that aren't divisible by 2.
Can you please attempt to export a movie in AVI format? Go to File > Export > Movie > Browse > Click on the format dropdown list and select AVI. Please let us know if it fails or not as well so we can incorporate this information into the ticket. Thanks.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pencil2d/pencil/issues/1491#issuecomment-718922310, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARRZDIGNCEOXNZBZSBZCPCLSNGUEHANCNFSM4TDLBZVQ .
@JayPrice1 Thank you for taking the time to test that! This confirms it's an issue exclusive to MP4 with H264 codec then. If you want to export with MP4 you'd need to adjust the resolution to be divisible by 2 and so it's not larger than 2048 x 2048.
@davidlamhauge Unfortunately that seems to be the case. It's beyond our control that certain video codecs have inherent limitations, however it's also beyond regular users to have knowledge of these limitations.
As such we should try to warn or simply prevent them from going beyond or below certain sizes while exporting movies with specific formats and configurations.
This probably will become easier once we've decided on how to implement the settings dialog proposed in #1114
Sorry about the confusion on the other issue... Considering this isn't a bug caused by Pencil2D but rather by FFMPEG, I suggest we turn this into an enhancement request so Pencil2D will enforce a check that H.264 / MP4 videos always need to have dimensions divisible by 2.
We'd need a warning pop-up too if the movie dimensions (width / height) are found to be indivisible by 2 once the user presses "export". It should also recommend to change the dimension in the actual camera layer and not on the output size (considering this scales the resulting image)
As an alternative to scaling or failing, we could always just add a pixel of padding to one side.
Issue Summary
When I export a project to movie, I receive an error code that it failed. This has occurred the last 5 times I've tried to use Pencil2d. I tried deleting and replacing Pencil2d, but this did not prevent the error.
### Actual Results Received error code and movie file does not open, expected the movie to save and play ### Expected Results Movie should save to location and be playable. ### Video or Image Reference ![Pencil2D_Error_Exporting_Movie](https://user-images.githubusercontent.com/73634208/97538199-412ce600-197d-11eb-91a9-e9e77e59ddf1.png) Error Code Received: Command: C:/Users/price/Desktop/Video Tools/Pencil2D/plugins/ffmpeg.exe -f rawvideo -pixel_format bgra -video_size 1067x600 -framerate 10 -i - -threads 4 -pix_fmt yuv420p -y C:/Users/price/Desktop/ETjack.mp4 ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.2.1 (GCC) 20190212 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. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100 Input #0, rawvideo, from 'pipe:': Duration: N/A, start: 0.000000, bitrate: 204864 kb/s Stream #0:0: Video: rawvideo (BGRA / 0x41524742), bgra, 1067x600, 204864 kb/s, 10 tbr, 10 tbn, 10 tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264)) [swscaler @ 0000019118a0ffc0] Warning: data is not aligned! This can lead to a speed loss [libx264 @ 00000191189bb400] width not divisible by 2 (1067x600) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height Conversion failed! Exit status: CrashExit Exit code: 1 System Info Pencil version: 0.6.5 (stable) Build ABI: x86_64-little_endian-llp64 Kernel: winnt, 10.0.19041 Operating System: Windows 10 (10.0) end ### Steps to reproduce File/Export/Movie/OK ### System Information + Pencil2D Version: Version: 0.6.5 commit: 50a0c7c318f38988af85d34e955a5a78d3953474 date: 2020-08-01_01:32:15 Operating System: Windows 10 (10.0) CPU Architecture: x86_64 Qt Version: 5.12.9 + Operating System: Windows 10 + RAM Size: 8GB + Graphics Tablet: