ffmpeg过滤视频,剔除音频的操作
ffprobe -v quiet -print_format json -show_format -show_streams 1.mp4
{ "streams": [ { "index": 0, "codec_name": "aac", "codec_long_name": "AAC (Advanced Audio Coding)", "profile": "LC", "codec_type": "audio", "codec_time_base": "1/44100", "codec_tag_string": "mp4a", "codec_tag": "0x6134706d", "sample_fmt": "fltp", "sample_rate": "44100", "channels": 2, "channel_layout": "stereo", "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": 8002562, "duration": "181.463991", "bit_rate": "48559", "max_bit_rate": "48559", "nb_frames": "7816", "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": "SoundHandler" } }, { "index": 1, "codec_name": "h264", "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", "profile": "Main", "codec_type": "video", "codec_time_base": "27197/308700", "codec_tag_string": "avc1", "codec_tag": "0x31637661", "width": 720, "height": 960, "coded_width": 720, "coded_height": 960, "has_b_frames": 1, "pix_fmt": "yuvj420p", "level": 31, "color_range": "pc", "color_space": "smpte170m", "color_transfer": "bt709", "color_primaries": "smpte170m", "chroma_location": "left", "refs": 1, "is_avc": "true", "nal_length_size": "4", "r_frame_rate": "60/1", "avg_frame_rate": "154350/27197", "time_base": "1/618000", "start_pts": 0, "start_time": "0.000000", "duration_ts": 112052052, "duration": "181.314000", "bit_rate": "94498", "bits_per_raw_sample": "8", "nb_frames": "1029", "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" } } ], "format": { "filename": "1.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": "181.488000", "size": "3303955", "bit_rate": "145638", "probe_score": 100, "tags": { "major_brand": "isom", "minor_version": "512", "compatible_brands": "isomiso2avc1mp41", "encoder": "Lavf57.58.101" } } }
static function filter_record_videos(&$record_videos) { if(count($record_videos)>0){ foreach ($record_videos as $k=>$record_video){ $shell_command = "ffprobe -v quiet -print_format json -show_format -show_streams $record_video"; $command_json = shell_exec($shell_command); $video_info = json_decode($command_json,true); if(isset($video_info['streams']) && count($video_info['streams']) == 1 && $video_info['streams'][0]['codec_type'] == 'audio'){ SimpleLog::GetInstance()->Error('video_have_voice_only:'.json_encode($record_video)); unset($record_videos[$k]); } } } }
版权声明:
作者:ForDream
链接:https://ishoud.com/index.php/2021/08/24/113.html
来源:工具人
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
海报
ffmpeg过滤视频,剔除音频的操作
ffprobe -v quiet -print_format json -show_format -show_streams 1.mp4
{
"streams": [
{
"index": 0,
"codec_nam……

共有 0 条评论