The FFmpegVideoStream protocol handler allows reading, writing, streaming and receiving video data in different format with a lot of different options. It uses the FFmpeg Java port of JavaCV and is available in the video feature

Options

Codec options (FFmpeg only)

FFmpeg allows fine-tuning of codec parameters (See the FFmpeg streaming guide). To activate these options, use "codec:" in front of the parameter:

Schema

The output of the handler provides the following attributes as a schema. Attributes can be in arbitrary order and will be identified by the type.

NameTypeDescription
imageIMAGEJCVThe current frame of the video stream
starttimestampSTARTTIMESTAMPThe start time stamp of the frame. Depends on the timestampmode option, will be omitted when set to 'none'
endtimestampENDTIMESTAMPThe end time stamp of the frame. Depends on the timestampmode option, will be omitted when set to 'none'

Example

This example shows how to read a video file and stream it to a remote client in video speed with h264, ultrafast, zerolatency and 400kBit/s:

PQL

video = ACCESS({source='Video', 
				 wrapper='GenericPull', 
				 transport='none', 
				 protocol='FFmpegVideoStream', 
				 datahandler='Tuple',
				 options=[
							['streamUrl', 'video.avi'],
							['timeStampMode', 'filetime'],
							['useDelay', 'true']
					     ],					     
				schema=	 [	
							['image', 			'IMAGEJCV'],
							['starttimestamp', 	'STARTTIMESTAMP'],
							['endtimestamp', 	'ENDTIMESTAMP']        					
        				 ]})

/// or shorter, as a source operator:
video = FFMPEGVIDEO({source='Video', options=[['streamUrl', 'video.avi'], 
                                              ['timeStampMode', 'filetime'], 
                                              ['useDelay', 'true']]})
 
output = SENDER({sink='Sink',
				wrapper='GenericPush',
				transport='none',
				protocol='FFmpegVideoStream',
				dataHandler='Tuple',
				options=[	['framerate', '30.0'],
							['streamUrl', 'udp://127.0.0.1:12345'],
							['bitrate', '400000'],
							['format', 'h264'],
							['codec:tune', 'zerolatency'],
							['codec:preset', 'ultrafast']
						]
				}, 
				video)

 

This example shows how to receive a video stream and write it to an mp4 video file using the MPEG-4 codec (13).

PQL

video = ACCESS({source='Video', 
				 wrapper='GenericPull', 
				 transport='none', 
				 protocol='FFmpegVideoStream', 
				 datahandler='Tuple',
				 options=[
							['streamUrl', 'udp://127.0.0.1:12345'],
							['timeStampMode', 'none']
					     ],					     
				schema=	 [	
							['image', 			'IMAGEJCV']        					
        				 ]})
 
/// or shorter, as a source operator:
video = FFMPEGVIDEO({source='Video', options=[['streamUrl', 'udp://127.0.0.1:12345'],
                                              ['timeStampMode', 'none']]})
 
output = SENDER({sink='File',
				wrapper='GenericPush',
				transport='none',
				protocol='FFmpegVideoStream',
				dataHandler='Tuple',
				options=[	['framerate', '30.0'],
							['streamUrl', 'video.mp4'],
							['videoCodec', '13']
						]
				}, video)