Encode H265 to hvc1 codec

前端 未结 3 976
醉酒成梦
醉酒成梦 2021-02-04 19:34

Here is the info of my source file:

I want to keep audio quality and just encode the video track so I use this command:

ffmpeg -i INPUT -c:a copy -c:v l         


        
3条回答
  •  时光说笑
    2021-02-04 20:03

    Using the latest ffmpeg (N-87630-ge9f9175-tessus or building from HEAD) you can encode to the MP4 version that macOS High Sierra Quicktime requires by using using -tag:v hvc1.

    If you have a hev1-based mp4 and you need the container to be hvc1 and you do not want to re-encode it:

    ffmpeg -i input-hev1.mp4 -c:v copy -tag:v hvc1 -c:a copy output-hvc1.mp4
    

    Use ffprobe to confirm the change:

    From:

    ~~~~
    Stream #0:0(eng): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 720x404, 164 kb/s, 29.97 fps,
    ~~~~
    

    To:

    ~~~~
    Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, progressive), 720x404, 164 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 29.97 tbc (default)
    ~~~~
    

    If you have an older avc1 based mp4, you will need to re-encode it.

    ffprobe example (avc1):

    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 960x540 [SAR 1:1 DAR 16:9], 2778 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
    

    Encoding Example:

    ffmpeg 
        -i input.mp4 \
        -c:v libx265 \
        -preset slow \
        -vf scale="720:trunc(ow/a/2)*2" \
        -crf 28 \
        -tag:v hvc1 \
        -c:a aac -b:a 44100 \
        output-hvc1.mp4
    

    The key is the -tag:v hvc1, without that you will end up with an hev1-based container that Quicktime 10.4+ (High Sierra) will not open.

提交回复
热议问题