Can we trim the vides with both ffmpeg and ffprobe?

Currently, I am working on an ETL process, and in the final stage of preprocessing my videos, I used to first auto detected black-screen frames using ffprobe and then trim. Now, while performing trimming I am not getting the desired result and sometimes, getting errors. Can someone from the community help me to figure this out?

You can use ffmpeg to trim a video by specifying the start and end times of the section you want to keep. Here’s an example command that will trim a video file called input.mp4 and save the result to a new file called output.mp4:
ffmpeg -i input.mp4 -ss 00:00:30 -to 00:01:30 -c copy output.mp4This command will keep the section of the video that starts at the 30-second mark and ends at the 1-minute and 30-second mark. The -c copy flag tells ffmpeg to simply copy the specified section of the video without re-encoding it, which will preserve the original quality and make the process faster.

Got it! And what about its durations, framerate, etc? Is there any other command or we can add the flags in the same command?

Hi ,
You can use ffprobe to get information about a video file, such as its duration, bitrate, and frame rate. For example:
ffprobe -v error -show_entries stream=duration,bit_rate -of default=noprint_wrappers=1 input.mp4
This command will print the duration and bitrate of the input.mp4 file to the terminal.

In my case, the FFmpeg video duration is not equal to the duration after the HLS process. Does anybody know the valid reason for this?

Sometimes, the duration of a video file as reported by ffmpeg, and the duration of the same video after being processed into HLS segments may differ slightly due to various factors such as encoding and processing.
Here are a few possible reasons why this may happen:

  1. Rounding errors: The duration of the video file may be displayed to a certain number of decimal places by ffmpeg, while the duration of the HLS segments may be rounded to the nearest whole number of seconds.
  2. Encoding differences: The video file and the HLS segments may be encoded using different codecs or settings, which can affect the duration slightly.
  3. Processing differences: The process of segmenting the video file into HLS segments may introduce additional processing overhead, which can affect the duration slightly.

AFAIK, it is also possible that there could be other factors at play that are causing the difference in duration. If the difference in duration is significant or causing problems, you may want to try re-encoding the video file or adjusting the HLS segmentation settings to see if that helps.