0

I'm using the following FFmpeg script to cut part of video and save it:

#!/bin/bash

# Input parameters
input_video=$1
start_time=$2
end_time=$3
output_video=$4

# Calculate duration
duration=$(echo "$end_time - $start_time" | bc)

# Use ffmpeg to cut the video
ffmpeg -y -i "$input_video" -ss "$start_time" -t "$duration" -c copy "$output_video"

The problem is, that for durations shorter than ~4s, only the audio gets exported. I couldn't find anything about that issue on the internet and BingAi also didn't find anything usefull.

The videos I'm cutting are default mp4, 1920X1080, 60fps OBS screen recordings.

Does anyone know how to fix that?

Note, that in practice I'm only using the last line of that code. Export the last line to .bat file with Wolfram Mathematica and then run that .bat file also from Mathematica (latest version of Mathematica, latest version of Windows). It's probably not relevant for this issue, but I wrote it just in case.

2
  • 3
    You are exporting in Copy mode. This requires times to be assigned to keyframes. They are most likely too far apart. Try encoding, by removing -c copy, and see what happens.
    – Sark
    Commented Oct 6, 2023 at 21:48
  • thx, that worked
    – Gal Zajc
    Commented Oct 7, 2023 at 10:46

0

You must log in to answer this question.

Browse other questions tagged .