Break Long Video into Parts with "ffmpeg"

This section provides a tutorial example on how to extract a segment from a video, trim off leading part or trailing part of a video, or break a long video in shorter parts.

If you know the starting position and ending position of a movie segment, you can use the "ffmpeg" command extract that segment out into a new movie file with the following command line:

ffmpeg -i input_file -ss hh:mm:ss[.xxx] -to hh:mm:ss[.xxx] output_file

Let's try this to extract the "Anchor 'Great Escape'" segment out of the SWF file, Tony_reelshow_2009_512kb.swf:

   -i Tony_reelshow_2009_512kb.swf 
   -ss 00:00:25.80 -to 00:00:43.33 Anchor_Great_Escape.swf

frame=136 fps=0.0 q=2.8  size=302kB time=00:00:05.44 bitrate= 455.0
frame=397 fps=397 q=5.9  size=893kB time=00:00:15.88 bitrate= 460.4
frame=438 fps=405 q=9.3 Lsize=978kB time=00:00:17.55 bitrate= 456.4

video:692kB audio:275kB subtitle:0kB other streams:0kB 
   global headers:0kB muxing overhead: 1.205118%

It seems to be working. The output has only 692 KB video data and 275 KB audio data now.

Verify the output by playing it with Flash Player Projector:

C:\herong>\local\bin\flashplayer_13_sa Anchor_Great_Escape.swf

Of course, you use "-ss hh:mm:ss[.xxx]" alone to truncate (trim off) leading part of a video file. Or use "-to hh:mm:ss[.xxx]" alone to truncate (trim off) trailing part of a video file.

You can also use "-t hh:mm:ss[.xxx]" to specify a duration for the output file. For example, you can use the following commands to break a long video file into multiple 30-minute parts:

ffmpeg -i input_file -ss 00:00:00 -t 00:30:00 output_part_1
ffmpeg -i input_file -ss 00:30:00 -t 00:30:00 output_part_2
ffmpeg -i input_file -ss 01:00:00 -t 00:30:00 output_part_3

Table of Contents

 About This Book

 Introduction of Adobe Flash

 Adobe Flash Player Plugin for Firefox

 Adobe Flash Player Plugin for Chrome

 Adobe Flash Player Plugin for Safari

 Adobe Flash Player ActiveX for IE

 Using "object" Elements for Flash Files

 Using "embed" Elements for Flash Files

 "mp3player" - MP3 Music Player

 SWFObject - Hidding "object" behind JavaScript

 Flash Player Projector

 SWFTools - SWF File Manipulation Tools

 SWFC Script to Generate Flash SWF Files

 ActionScript Embedded in SWFC Script

 AS3Compile - ActionScript 3 Compiler

 Adobe Flex SDK 4

 SWF File Structure and Tags

 SWF File Processing Rules

SWF Files for Video and Audio Streams

 Video and Audio Stream SWF File Structure

 Installing FFmpeg to Manipulate Video SWF Files

 Playing Movie with FFmpeg "ffplay" Command

 See File Properties with FFmpeg "ffprobe" Command

 Convert File Format with "ffmpeg" Command

 Issue with "ffplay" on SWF Output File

 "ffplay" Interactive Commands

Break Long Video into Parts with "ffmpeg"

 Concatenate Video Files with "ffmpeg"

 Video/Audio Stream Concatenation Order

 Split Audio Stream Out of SWF File

 Split Video Stream Out of SWF File

 Merge Video and Audio Streams to SWF File

 Reduce Video Stream Resolution

 Reduce Video Frame Rate

 Outdated Tutorials


 Full Version in PDF/EPUB