1

我正在使用 ffmpeg 将 MKV(Matroska 视频文件)编码为 2x MP4(H264 - 720p Main@L4)和(H264 - 360p Baseline@L3.1)。

使用时遇到非常奇怪的问题-c:v h264_nvenctee muxer然后生成的输出文件is_avc=false甚至我已经检查了相同的输入 matroska 文件与运行英特尔 QuickSync-c:v h264_qsv的另一台服务器使用相同的命令,然后生成的输出文件是is_avc=true.

我想要的主要目标is_avc=true是因为必须使用nginx-vod-module需要流式传输 AVC 视频格式的文件来播放文件。

重现问题的步骤:

  • 具有 NVENC 支持的自定义 ffmpeg 构建ffmpeg version N-91182-gbdf1bbd Copyright (c) 2000-2018 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
  • ffprobeversion 4.0.2-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2007-2018 the FFmpeg developers
  • 使用 NVENC 和 tee muxer 运行 ffmpeg 命令行
    /root/ffmpeg  -y -t 00:00:50 -i "testinput.mkv" -filter_complex "[0:v]split=2[s0][s1];[s0]scale=-2:720[v0];[s1]scale=-2:360[v1]" -map "[v0]" -map "[v1]" -map 0:a -c:v h264_nvenc -b:v:0 1100k -b:v:1 600k -profile:v:0 main -profile:v:1 baseline -level:v:0 4 -level:v:1 3.1 -ac 2 -c:a aac -b:a 128k -af "aresample=async=1000:first_pts=0"  -f tee "[select=\'v:0,a\']testoutput.mp4|[select=\'v:1,a\']testoutput-360.mp4"
  • 为输出文件运行 ffprobe 以检查“is_avc”:
    ./ffprobe -v quiet -print_format json -show_format -show_streams testoutput.mp4
  • 我当前的 ffprobe 输出结果是:

    
    ./ffprobe -v quiet -print_format json -show_format -show_streams testoutput.mp4
     {
        "streams": [
            {
                "index": 0,
                "codec_name": "h264",
                "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
                "profile": "Main",
                "codec_type": "video",
                "codec_time_base": "1001/48000",
                "codec_tag_string": "avc1",
                "codec_tag": "0x31637661",
                "width": 1280,
                "height": 720,
                "coded_width": 1280,
                "coded_height": 720,
                "has_b_frames": 0,
                "sample_aspect_ratio": "1:1",
                "display_aspect_ratio": "16:9",
                "pix_fmt": "yuv420p",
                "level": 40,
                "chroma_location": "left",
                "refs": 1,
                "is_avc": "false",
                "nal_length_size": "0",
                "r_frame_rate": "24000/1001",
                "avg_frame_rate": "24000/1001",
                "time_base": "1/24000",
                "start_pts": 984,
                "start_time": "0.041000",
                "duration_ts": 1201200,
                "duration": "50.050000",
                "bit_rate": "845035",
                "bits_per_raw_sample": "8",
                "nb_frames": "1199",
                "disposition": {
                    "default": 1,
                    "dub": 0,
                    "original": 0,
                    "comment": 0,
                    "lyrics": 0,
                    "karaoke": 0,
                    "forced": 0,
                    "hearing_impaired": 0,
                    "visual_impaired": 0,
                    "clean_effects": 0,
                    "attached_pic": 0,
                    "timed_thumbnails": 0
                },
                "tags": {
                    "language": "und",
                    "handler_name": "VideoHandler"
                }
            },
            {
                "index": 1,
                "codec_name": "aac",
                "codec_long_name": "AAC (Advanced Audio Coding)",
                "profile": "LC",
                "codec_type": "audio",
                "codec_time_base": "1/48000",
                "codec_tag_string": "mp4a",
                "codec_tag": "0x6134706d",
                "sample_fmt": "fltp",
                "sample_rate": "48000",
                "channels": 2,
                "channel_layout": "stereo",
                "bits_per_sample": 0,
                "r_frame_rate": "0/0",
                "avg_frame_rate": "0/0",
                "time_base": "1/48000",
                "start_pts": 0,
                "start_time": "0.000000",
                "duration_ts": 2401488,
                "duration": "50.031000",
                "bit_rate": "129153",
                "max_bit_rate": "129153",
                "nb_frames": "2346",
                "disposition": {
                    "default": 1,
                    "dub": 0,
                    "original": 0,
                    "comment": 0,
                    "lyrics": 0,
                    "karaoke": 0,
                    "forced": 0,
                    "hearing_impaired": 0,
                    "visual_impaired": 0,
                    "clean_effects": 0,
                    "attached_pic": 0,
                    "timed_thumbnails": 0
                },
                "tags": {
                    "language": "ger",
                    "handler_name": "SoundHandler"
                }
            }
        ],
        "format": {
            "filename": "Leonmusssterben20171080p.mp4",
            "nb_streams": 2,
            "nb_programs": 0,
            "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
            "format_long_name": "QuickTime / MOV",
            "start_time": "0.000000",
            "duration": "50.031000",
            "size": "6116472",
            "bit_rate": "978029",
            "probe_score": 100,
            "tags": {
                "major_brand": "isom",
                "minor_version": "512",
                "compatible_brands": "isomiso2avc1mp41",
                "encoder": "Lavf58.17.100"
            }
        }
    }
    

请任何人都可以帮助我为什么输出视频文件越来越“is_avc=false”?

有没有办法强制它?

谢谢

4

0 回答 0