Usage of ffmpeg complex filter


The goal: to pick two segments, 0-10sec and 20-31sec, from a 41 second long video in.mp4, to form a 20 second long video out.mp4.
The code:
ffmpeg.exe -i in.mp4 -filter_complex ^
“[0:v]trim=duration=10[V0]; [0:a]atrim=duration=10[A0]; ^
[0:v]trim=start=20:end=31,setpts=PTS-STARTPTS[V1]; [0:a]atrim=start=20:end=31,asetpts=PTS-STARTPTS[A1];[V0][A0][V1][A1]concat=n=2:v=1:a=1[V01][A01]” -map [V01] -map [A01] out.mp4
Explanation:
-i what’s following is input file.
-filter_complex complex because there are intermediate outputs.
[0:v] 0 means the input file after first -i, in.mp4 in this case. v means video stream.
[V0] the name of output of [0:v] after applying “trim=duration=10”. the first video output
[0:a] similar to [0:v] but audio.
[A0] similar to [V0] but audio. the first audio output
[V1] and [A1] are the output video and audio of second segment.
setpts and asetpts means to reset the Presentation Time Stamps.
-map tells what output to mux into the final output file.
out.mp4 is one of the output files, which is for the -maps preceding it.
what follows -map can be:
-map [V01] filter output name, like in the example above.
-map single_highest_quality_video_stream_from_all_inputs
-map 0 means the video and audio of the first input file

Advertisements

Minimum Roku Video Channel


This is a minimum Roku channel that shows up on Roku TV home screen and plays HLS video.

Screen shot: http://riowing.net/p/MiniChannel2.mp4

Folder structure:

source/
main.brs is the only source file, in BrightScript language.
images/
two .png files. one as home screen tile, one as spalash screen when entering channel.
manifest: some meta data such as title and resolution.

A typical channel would have a components/ folder with .xml and .brs files. I moved the essential components into the main.brs file to keep the channel to minimum.
mian.brs: Main() is the entry point to create screen, which in turn creates Scene, which in turn creates Video, which has a ContentNode with HLS URL property.
Installation process: make a zip file and post it to HTTP plugin_install API of the Roku device like so:
curl -v –user “rokudev:YourPassWord” –anyauth -F “mysubmit=Install” -F “archive=@MinimumVideo.zip” “http://192.168.1.8/plugin_install” The IP belongs to the Roku device.
All files can be downloaded from http://riowing.net/p/MinimumVideo.zip

 

Why image compressible


Why can images be compressed?
Due to human eye:
Not sensible to chroma as to luma, which leads to YUV compression.
Not sensible to red and blue as to green, which leads to Bayer format.
Not sensible to high frequency change, AKA details, which leads to DCT
Due to redundancy´╝Ü Lossless compression

VAST video ad from scratch


JW Player plays video ads with absence of ads server.
http://riowing.net/ads/AdsNoSvr.htm

Key components:
Ad Tag .xml file in the html page
ClickThrough and MediaFile in the xml, for ad destination URL and ad video file