r/ffmpeg • u/Electronic-Quiet-176 • 16h ago
Having no luck in adding one black frame to the beginning and end without losing overall bit rate and video quality
When I submit my film to a distributor, the system gives an error that I am missing one black frame at the beginning and at the end of the film. I have tried to tpad and other options, which did not work but I thought for sure the concat would work
First I create a solid 3840x2160 black colored png file that had the same 4K UHD HDR format as my mp4 file and saved it as black-frame.png
Followed by using the following to convert it to match the video:
ffmpeg -framerate 23.976 -i black-frame.png -c:v libx265 -x265-params "crf=0:vbv-maxrate=50000:vbv-bufsize=250000:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=475,385:ref=2" -pix_fmt yuv420p10le -vsync 1 -b:v 59.18M black-frame.mp4
In a text file called inputs.txt:
file 'black-frame.mp4'
file 'Not-if-ac3.mp4'
file 'black-frame.mp4'
Then I used the concat command to bring them together:
ffmpeg -f concat -safe 0 -i inputs.txt -c copy Not-if-aac-w-black-frames.mp4
But this reduces the video from an overall bit rate of 59.5 MB/s to 29.5 MB/s and the framerate changed as well from 23.976 to 11.976 - I thought the -c copy was supposed to not change anything in the video quality
I have also tried:
ffmpeg -i Not-if-aac.mp4 -filter_complex "[0:v]tpad=start=1:stop=1:color=black[v]" -map "[v]" -map 0:a? -c:v libx265 -crf 0 -c:a copy Not-if-aac-w-black-frames.mp4
But then it loses it's HDR format and it changes the audio from AC3 to AAC - see second screenshot
Why isn't the "copy" working?