User Tools

Site Tools


ffmpeg

This is an old revision of the document!


Table of Contents

FFMEPG

and FFPLay



ffmpeg has many uses, and one area that is very useful for us is to be able to extract from either SPTS or MPTS transport stream (.ts) files to .mp4. There are a lot more players that can handle .mp4, and when testing UHD streams, most TVs will play .mp4 from a memory stick, not many will handle .ts (especially if it's MPTS).

Chris Duxbury has worked out a simple syntax we can use to extract our .ts files to .mp4 files (.mp4 is a valid container for both h.264 and HEVC steams).

FFMEPG

The following syntax will work for SPTS files (not sure about MPTS)

 ffmpeg -probesize 50000000 -i source.ts -map 0:0 -map 0:1 -map 0:2 -c copy destination.mp4


The probesize bit tells ffmpeg to look over lots of file for the I picture, otherwise on long GOP it seems to give up sometimes. (like most decoders, ffmpeg can't start to decode until it finds an I frame)

Using -map 0:0 -map 0:1 -map 0:1 -map 0:2 tells ffmpeg to select/map specified input streams to output in that order.

Using -c copy mark all the streams to be just copied to the output

FFPLAY

FFPLAY comes bundled with the ffmpeg download. The ffplay is a simple to use command line app for playing the extracted streams that you have just created.

The simple use of fflplay is just:

  ffplay filename.mp4


However, the issue with UHD streams is that they are larger than most monitors, so it is generally necessary to either rescale the output, or force it to fullscreen.

To replay a video in a window.

  ffplay -i video.mpg -vf scale=800x600
  
  This will replay the selected file at a window size of 800x600. Remember, currently (End 2016) 
  UHD streams play very poorly and you will only get 1 or 2 frames per second. 


To replay a video full screen.

  ffplay -i video.mpg -vs
  
  This will replay the video at fullscreen resolution.



ffmpeg.1479899743.txt.gz · Last modified: 2023/03/09 22:35 (external edit)