0
I'm trying to encode the video in the same quality in the same format, but the output file is several times larger than the input file. Whyis it happens? I want to fix the encoding errors, but I can not do it without losing quality or increasing the file size. How to encode mp4 video without losing quality and increasing the size in Linux terminal?
I want to use the video to show online on my site. I'm using the call to ffmpeg below
ffmpeg input.mp4 -c:v libx264 -preset placebo -crf 0 -c:a aac -movflags faststart output.mp4
P.S. I will add here an example of errors. Even if I get here, I want to understand why ffmpeg increases my files. I encounter this regularly. This is the main question.
[h264 @ 0x56524c25dea0] Invalid NAL unit 0, skipping.
[h264 @ 0x56524c25dea0] error while decoding MB 32 2, bytestream -7
[h264 @ 0x56524c216260] Invalid NAL unit 0, skipping.
[h264 @ 0x56524c216260] error while decoding MB 46 16, bytestream -5
[h264 @ 0x56524c25dea0] Invalid NAL unit 8, skipping.
[h264 @ 0x56524c25dea0] error while decoding MB 36 1, bytestream -13
[aac @ 0x56524c1e6ea0] Number of bands (57) exceeds limit (44).
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x56524c1e6ea0] channel element 3.10 is not allocated
Error while decoding stream #0:1: Invalid data found when processing input
...
[aac @ 0x56524c1e6ea0] Number of bands (48) exceeds limit (44).
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x56524c1e6ea0] Error decoding AAC frame header.
Error while decoding stream #0:1: Error number -50531338 occurred
[aac @ 0x56524c1e6ea0] Input buffer exhausted before END element found
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x56524c1e6ea0] decode_pce: Input buffer exhausted before END element found
Error while decoding stream #0:1: Invalid data found when processing input
[null @ 0x56524c1e7d20] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 12351488 >= 12350464
[null @ 0x56524c1e7d20] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 12351488 >= 12351488
1What are the "encoding errors" you're trying to fix? If size is most important, why not just leave it as-is, or lower the quality or shrink it? – Xen2050 – 2018-04-20T11:05:38.717
I added it. Then I have 2 questions:
When I encode a file from one format to another, I get a side effect in the form of loss of quality or increase in size. I can accept this fact. But! If I encode a file in the same format in its original quality, why its size increases. What is this trick? ffmpeg says, here is the same file, but larger, since you do not have anything to occupy the hard drive. This not normal! – karpo518 – 2018-04-20T11:41:29.933
Don't add your actual question in comments to your question. If you change format it's expected that something changes as you likely need to reencode a file. Check the properties of both files to check whenever they're actually the same. – Seth – 2018-04-20T13:01:34.750