resolve_convert.sh misdetects video files as audio-only due to trailing comma in ffprobe CSV output
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
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.
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
- Place a video file (e.g., DJI drone MP4) in a folder
- Run ./resolve_convert.sh /path/to/folder
- 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/,$//')
- Dominant language
- Shell
- Stars
- 72
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ChrisTitusTech/resolve-linux
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
All issues in ChrisTitusTech/resolve-linux
Similar issues
-
docs(agents): strengthen the no-backslash-escaped-backticks rule with an issue-creation example Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
package-update
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
oSoWoSo/vOid_Community_repOsitory#148 · 1 comment ·
-
chore
Difficulty 1/5 Under an hour Newbie friendliness 91/100
alunduil/alunduil-chezmoi#792 ·
-
area: compat bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
zenhub-dev
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenLiberty/ci.docker#747 ·