Is there an ffprobe command I can run to see if an mov file that I have is audio-only or contains video as well? I have various mov files, some of which are audio dubs and s
To find out programmatically if a video file has audio, use avformat_open_input() as shown here below - if audio_index is bigger or equal to zero, then the video file has audio.
if (avformat_open_input(&pFormatCtx, filename, nullptr, nullptr) != 0) {
fprintf(stderr, "Couldn't open video file!\n");
return -1;
}
if (avformat_find_stream_info(pFormatCtx, nullptr) < 0) {
fprintf(stderr, "Couldn't find stream information!\n");
return -1;
}
av_dump_format(pFormatCtx, 0, videoState->filename, 0);
for (i = 0; i < pFormatCtx->nb_streams; i++) {
if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO && video_index < 0)
video_index = i;
if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO && audio_index < 0)
audio_index = i;
}