1

这是我使用 FFProbe 获得的输出,我确定是变形的视频。我已将其转换为使用 ffmpeg 进行的测试,结果与具有不同 PAR 和 DAR 的视频一致(视频被压扁)。我运行了一些命令行参数来修复变形视频并且它起作用了。可能我的诊断不正确,PAR 和 DAR 完全是错误的?

我用来“纠正”变形的代码是

--custom-anamorphic --display-width 1280 --keep-display-aspect --modulus 8 --crop 0:0:0:0

是否有带有 FFProbe 的附加命令来检测变形?到目前为止,我只是看看 sample_aspect_ratio 和 display_aspect_ratio 是否相同。

此外,0:1 的比例似乎不正确。我的视频不是无限宽的。FFProbe 输出是否存在错误?

这是命令

-print_format json -show_format -show_streams {originalFilePath}

2013 年 6 月 27 日构建的 FFProbe 版本 N-54233-g86190af 输出以下内容:

"Output{
    \"streams\": [
        {
            \"index\": 0,
            \"codec_name\": \"h264\",
            \"codec_long_name\": \"H.264/AVC/MPEG-4AVC/MPEG-4part10\",
            \"profile\": \"Main\",
            \"codec_type\": \"video\",
            \"codec_time_base\": \"1/5994\",
            \"codec_tag_string\": \"avc1\",
            \"codec_tag\": \"0x31637661\",
            \"width\": 1280,
            \"height\": 720,
            \"has_b_frames\": 0,
            \"sample_aspect_ratio\": \"0: 1\",
            \"display_aspect_ratio\": \"0: 1\",
            \"pix_fmt\": \"yuv420p\",
            \"level\": 31,
            \"r_frame_rate\": \"2997/100\",
            \"avg_frame_rate\": \"2997/100\",
            \"time_base\": \"1/2997\",
            \"start_pts\": 0,
            \"start_time\": \"0.000000\",
            \"duration_ts\": 204100,
            \"duration\": \"68.101435\",
            \"bit_rate\": \"3894381\",
            \"nb_frames\": \"2041\",
            \"disposition\": {
                \"default\": 0,
                \"dub\": 0,
                \"original\": 0,
                \"comment\": 0,
                \"lyrics\": 0,
                \"karaoke\": 0,
                \"forced\": 0,
                \"hearing_impaired\": 0,
                \"visual_impaired\": 0,
                \"clean_effects\": 0,
                \"attached_pic\": 0
            },
            \"tags\": {
                \"creation_time\": \"2013-05-0318: 33: 37\",
                \"language\": \"eng\",
                \"handler_name\": \"AppleAliasDataHandler\"
            }
        },
        {
            \"index\": 1,
            \"codec_name\": \"aac\",
            \"codec_long_name\": \"AAC(AdvancedAudioCoding)\",
            \"codec_type\": \"audio\",
            \"codec_time_base\": \"1/44100\",
            \"codec_tag_string\": \"mp4a\",
            \"codec_tag\": \"0x6134706d\",
            \"sample_fmt\": \"fltp\",
            \"sample_rate\": \"44100\",
            \"channels\": 2,
            \"bits_per_sample\": 0,
            \"r_frame_rate\": \"0/0\",
            \"avg_frame_rate\": \"0/0\",
            \"time_base\": \"1/44100\",
            \"start_pts\": 0,
            \"start_time\": \"0.000000\",
            \"duration_ts\": 3003392,
            \"duration\": \"68.104127\",
            \"bit_rate\": \"125304\",
            \"nb_frames\": \"2933\",
            \"disposition\": {
                \"default\": 0,
                \"dub\": 0,
                \"original\": 0,
                \"comment\": 0,
                \"lyrics\": 0,
                \"karaoke\": 0,
                \"forced\": 0,
                \"hearing_impaired\": 0,
                \"visual_impaired\": 0,
                \"clean_effects\": 0,
                \"attached_pic\": 0
            },
            \"tags\": {
                \"creation_time\": \"2013-05-0318: 33: 37\",
                \"language\": \"eng\",
                \"handler_name\": \"AppleAliasDataHandler\"
            }
        }
    ],
    \"format\": {
        \"filename\": \"\\\\\\\\dell690\\\\vsf\\\\_asset_intake\\\\v2\\\\ed69c939-4fe1-40dd-a045-db72ed2e0009\\\\original\\\\USTC_Overview2.mov\",
        \"nb_streams\": 2,
        \"format_name\": \"mov,
        mp4,
        m4a,
        3gp,
        3g2,
        mj2\",
        \"format_long_name\": \"QuickTime/MOV\",
        \"start_time\": \"0.000000\",
        \"duration\": \"68.100000\",
        \"size\": \"34267583\",
        \"bit_rate\": \"4025560\",
        \"tags\": {
            \"major_brand\": \"qt\",
            \"minor_version\": \"537199360\",
            \"compatible_brands\": \"qt\",
            \"creation_time\": \"2013-05-0318: 33: 37\"
        }
    }
}"
4

2 回答 2

2

要检测视频是否变形,您需要检查不是 1:1 的 sample_aspect_ratio。然而 0:1 的 sample_aspect_ratio 意味着它没有被指定。在这种情况下,如果也未指定 display_aspect_ratio (0:1),则它是非变形的。但是,如果指定了 display_aspact_ratio,那么我们需要比较 width:height 和 display_aspact_ratio,如果它们相同,则视频是非变形的,如果它们不同,则视频是变形的。

IsAnamorphic=
if sample_aspect_ratio=="1:1" then false
else if sample_aspact_ratio != "0:1" the true
else if display_aspect_ratio =="0:1" then false
else if display_aspect_ratio!=width:height then true
else false
于 2015-05-29T15:12:32.557 回答
0

将它带到 FFMpeg 团队后,我看到 0:1 意味着 PAR 未定义,如果两者都未定义,它们将始终相等——这种情况很容易检测到。

于 2013-06-28T16:47:45.830 回答