ChrisTitusTech / ChrisTitusTech/resolve-linux

resolve_convert.sh misdetects video files as audio-only due to trailing comma in ffprobe CSV output

Open Beginner friendly
#1 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Shell
Stars
72
Forks
10
PR merge metrics
No merged PRs in 30d

Description

Description

The get_media_type function in resolve_convert.sh uses ffprobe -of csv=p=0 to detect whether a
file contains video or audio. However, the CSV output format includes a trailing comma (e.g.,
video, instead of video), causing the string comparison [[ "$has_video" == "video" ]] to fail.
As a result, video files are incorrectly detected as audio-only and converted to .wav instead
of .mov.

Steps to Reproduce
  1. Place a video file (e.g., DJI drone MP4) in a folder
  2. Run ./resolve_convert.sh /path/to/folder
  3. Observe that some files are converted to .wav instead of .mov
Minimal Reproduction
  # This is what the script currently does:
  $ ffprobe -v quiet -select_streams v:0 -show_entries stream=codec_type -of csv=p=0 file.mp4 |
head -1
  video,

  # The trailing comma causes this comparison to fail:
  $ [[ "video," == "video" ]]; echo $?
  1
Expected Behavior

Video files should be detected as video and converted to .mov with DNxHR + PCM audio.

Actual Behavior

Video files are detected as audio and converted to .wav (audio-only), losing the video stream
entirely.

Root Cause

In get_media_type():

  has_video=$(ffprobe -v quiet -select_streams v:0 \
    -show_entries stream=codec_type -of csv=p=0 "$file" 2>/dev/null | head -1)

csv=p=0 outputs video, (with trailing comma). The comparison [[ "$has_video" == "video" ]]
fails, falling through to the audio branch.

Environment
  • OS: Arch Linux / CachyOS
  • ffmpeg version: 7.x
  • Script version: Latest main branch
Suggested Fix

Strip trailing commas from ffprobe output:

  has_video=$(ffprobe -v quiet -select_streams v:0 \
    -show_entries stream=codec_type -of csv=p=0 "$file" 2>/dev/null | head -1 | sed 's/,$//')
  has_audio=$(ffprobe -v quiet -select_streams a:0 \
    -show_entries stream=codec_type -of csv=p=0 "$file" 2>/dev/null | head -1 | sed 's/,$//')

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in resolve_convert.sh at the get_media_type function and reproduce the ffprobe CSV output described in the issue. Verify that video files are classified as video and converted to .mov, while audio-only files remain eligible for .wav conversion.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.