Trimming mp4 video

Pascal Jacquemart pascal at fluffyspider.com
Tue Feb 18 02:12:20 UTC 2020


Hi everyone,

I am trying to trim a mp4 video file, but having some issues with
something that simple.

I am running the following pipeline:
  filesrc ! qtdemux ! h264parse ! mp4mux ! filesink

At this stage, it creates an exact clone of the original video

Then I figured out I should do the following:
 - Start the pipeline in PAUSED state
 - Issue a SEEK with FLUSH and KEY_UNIT flags
 - Put the pipeline to PLAYING state
 - Wait for the EOS message

This does not work. The created file seems to be the right size but it
does not play.

After few experiments, I can create the trimmed video but only when I
start the whole pipeline in PLAYING state. Then the file is valid but I
can see the very first few frames of the original video before the
trimmed part.

My sample code is in here: https://trinket.io/python/185bdb1678
I might be missing something obvious?

Thanks,           Pascal





More information about the gstreamer-devel mailing list