you’d still have a loss of quality due to transcoding to a format your client supports.
If you have a fast network you could transcode to high-bitrate h264/h265 etc, which would have some quality loss but probably less than using h264 directly (due to Youtube’s aggressive compression).
But I’m not aware of anything that ties it altogether either, especially if the OP needs browser support.