Well. Turns out that if you read this guide for HLS streams, it gives a bunch of details on how the actual video formats should be set up. In particular, for HEVC, it says:
1.10. You SHOULD use video formats in which the parameter sets are stored in the > sample descriptions, rather than the samples. (i.e., Use ‘avc1’, ‘hvc1’, or
‘dvh1’ rather than ‘...
There is so much wrong with your command that it would take too long to list every issue. It will be simplest to just provide a corrected command:
ffmpeg -i input -c:v libx265 -crf 28 -c:a aac -b:a 128k -filter:v "scale=650:-2,format=yuv420p" -tag:v hvc1 -movflags +faststart output.mp4
If the input audio is already AAC consider stream copying with -c:a ...
It sounds like you're analyzing a HEVC bitstream. HEVC has multiple types of Random Access Pictures, only one of which clears the buffer. But ffmpeg flags all of them as keyframes.
You have to use the HEVC decoder to parse this info out. The skip_frame option, as implemented in the HEVC decoder, only decodes IDR frames.
ffmpeg -skip_frame nokey -i in....
Install FFMPEG with extra features by entering the following on a single line:
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libvorbis --with-libvpx --with-opus --with-x26
Wait about 10 minutes for it to install.
From the Terminal, run FFMPEG, using a line like this:
ffmpeg -i ...
Conversion always will involve some loss, only copy (-c) is lossless.
There are some suggestions for "lossless" encoding in this Q&A, but I can't test them on my phone. There are UpVoted and have an accepted answer: the intermediate and output file will be uncompressed, and huge.
You can minimize loss when converting your existing videos by choosing ...