HTTP Redirects in PHP

Here’s a really quick and simple example of an HTTP redirect using PHP.

The British Geological Survey publishes live data from its seismographs, located in many parts of the UK. The URL for the latest data changes daily, and is derived from the calendar. So it’s easy to reconstruct the URL. But I’d like to access the current day’s data for my local area from an unchanging, static URL.

Therefore, the static URL needs to create an HTTP redirect to the current day’s data from the location I want to use, my local seismograph at the former Royal Observatory at Herstmonceaux, Sussex. Here is the code to do that. The method ought to be self-explanatory. To be precise, this code causes the Apache webserver to instruct a client (your web browser) to follow a 302 Redirect.

You can give this page of PHP any name you like. My URL is http://johnwarburton.net/did-the-earth-move.php

$DIRECTORY = "http://www.earthquakes.bgs.ac.uk/helicorder/heli_dir_shz/";
$PREFIX    = "HMNX_SHZ_GB_00.";
$timestamp = date("Ymd");
$SUFFIX    = "00.gif";

$redirectUrl = $DIRECTORY.$PREFIX.$timestamp.$SUFFIX;

header("Location: ".$redirectUrl);
exit;

FFmpeg, SoX, x265, x264, GraphicsMagick, etc., Win64 binary installer

I have upgraded my binary distribution of open source multimedia utilities to include a proper installer, not just an archive. This distribution is for Windows 64 bit only, and is tested on Windows 10.

MultimediaTools-mingw-w64-Open-source.exe

These are usually very recent compilations of best-in-class open source programs for multimedia conversion, manipulation and exchange. Within this bundle are extremely full versions of: FFmpeg, SoX, x265, x264, x262, the Fraunhofer AAC encoder (including HE-AAC and HE-AAC2), the mpv player, LAME, GraphicsMagick, MP4Box, DCP-o-matic and many others. Many of these are world-standard programs, very actively maintained, and in constant use by broadcasters and multi-media companies on every continent.

These are all open source and free (as in both beer and speech), so you are welcome to download and use them, and much else beside, without any consideration beyond obeying the legal licences accompanying them. The licence usually forbids you from withholding the source code if you modify anything, and this is a very important rule that you must obey. If you just use the binary programs, you need probably not worry about anything else.

The source code for my compilation is available from GitHub, and the README file is fairly up-to-date. It contains information about other packages you will need to make some of these run (a Perl and a Python interpreter, for example).

GitHub source: https://github.com/Warblefly/MultimediaTools-mingw-w64

README: https://github.com/Warblefly/MultimediaTools-mingw-w64#readme

Binary distribution (download and run this installer): http://gallery.johnwarburton.net/MultimediaTools-mingw-w64-Open-source.exe

Prevent Samsung TV or Monitor from dimming

Some Samsung monitors automatically dim the backlight when the displayed video falls below a certain brightness. For professional editing, this is a nuisance. Here’s how to prevent it, at least on the C570 series e.g. T28C570

In picture settings, find “Movie” mode. This stops the dimming. Then, you must recalibrate your monitor’s saturations, contrast, brightness, sharpness, etc., as before.

My settings, for an HDMI input from an Intel HD560 graphics chipset, are:

Backlight
20
Contrast
95
Brightness
45
Sharpness
0
Colour
45

Also, turn off anything to do with “dynamic”, noise reduction, enhanced contrast, etc.

Honour Railway Pioneers: Run The Service

Generations of hard-working people toiled and risked their lives on the railways when they were being developed. In all conditions and across every kind of territory, they laid rails the length and breadth of Britain, and developed the machines to provide a public service.

Workers have been killed in falls, in collisions, by poisoning, by electric shock, by enemy bombs during wars, by fatigue, and by many other causes. They laboured and sometimes gave their lives to make a public railway for the good of the nation, where all passengers are trusted and treated well according to their payment of the fare, and where all workers are trusted and fairly treated according to their contracts. Today, I believe most people who work on railways still uphold these standards. Equally, the people who develop railway technology, or who have the vision to raise funding for rail development, do this because they want to build a better service for all the public — unless they’re merely opportunist investors.

Today, the Department for Transport, Govia Thameslink and the National Union of Rail, Maritime and Transport Workers have jointly shown they are unable to run a service. I see this as an insult to these workers’ sacrifices; and to the hundreds of thousands of ordinary people who pay their taxes, and who pay for their railway tickets. Today is the day to agree to stop the insults, and remember who put the railway there in the first place.

Metadata for Culture and Heritage

As part of my efforts with the ICOMOS-UK digital committee, I’ve started to collect metadata specifications relevant to heritage and culture.

My aim is to produce a superset with copious documentation and guides to subsets, so that all data is interchangeable. After all, if the Digital Production Partnership can join European and North American delivery standards for television in this way, isn’t anything possible?

Work begins at the link below. Suggestions are most welcome.

Audiovisual Archive Metadata & Preservation

FFmpeg, opendcp, sox, mpv and other tools, Windows binaries

UPDATE: now uses an .xz archive: much more efficient compression, though users need the xz program to open the archive (or a utility such as 7zip).

UPDATE: Easier to open archive: now uses .zip files readable by Windows Explorer.

Please see the GitHub page for other updates.

Up-to-date Windows binaries of the FFmpeg multimedia suite and many other tools used here on a daily basis are now available for download. Some of these binaries are statically linked, but the larger programs are dynamically linked. They’re Windows 64-bit binaries, and are tested on Windows 10.

The best thing to do is read the README file in my GitHub repository:

https://github.com/Warblefly/MultimediaTools-mingw-w64/blob/master/README.md

The REAME above is more up-to-date. But, best of all, look inside the archive.

To use these binaries, just use the compressed installer. You’ll want the xz program (or an archiver such as 7zip) to decompress it before installation.

http://gallery.johnwarburton.net/MultimediaTools-mingw-w64-Open-source.exe.xz

The installer sets these (and other) environment variables for you:

FONTCONFIG_FILE=fonts.conf
FONTCONFIG_PATH=C:\Users\—YOUR-USER-NAME—\AppData\Local\fontconfig
FREI0R_PATH=C:\Program Files\ffmpeg\lib\frei0r-1
TESSDATA_PREFIX=C:\Program Files\ffmpeg\share\
TERMINFO=C:\Program Files\ffmpeg\share\terminfo

The entire set of scripts and patches used to generate these utilities is available as a Git source tree for anyone’s use or modification.

A GNU/Linux machine running Fedora is used to compile the binaries, using scripts that owe much of their writing to Roger Pack and the Zeranoe team. I have modified Roger’s script to include, additionally, some extra programs and libraries used here. It is fair to say that the script is almost entirely Roger’s, and I’m very grateful indeed for its development.

Built by the script and, therefore, included in the binary distribution are the following programs among others. In the case of FFmpeg, just about every optional library has been compiled in, including the libfdk_aac audio codec. In most cases, each library or piece of software has been retrieved from its latest development sources so it is very up-to-date. I try to test all binaries; if you find that one you’re using is unsuitable for production use, please contact me and I’ll attend to the problem, or send you an earlier version.

Download the FFmpeg, mpv, sox, x264, x265 and many other binaries here:

http://gallery.johnwarburton.net/MultimediaTools-mingw-w64-Open-source.exe

To clone the Git source tree, install Git and do this:

git clone https://github.com/Warblefly/MultimediaTools-mingw-w64.git

Browse the tree here:

https://github.com/Warblefly/MultimediaTools-mingw-w64

LICENCES

Everything is open source. In the cross-compilation script, there are links to every source code distribution. There is no charge for source code, and no charge for these binaries. Please read the licences.

Much faster Avid ingest from any format

The venerable FFmpeg audio/video tool can now package its output in Avid Op-Atom format directly, without always needing to have its output wrapped by the raw2bmx tool. This method is very fast and, crucially, can be used on any computer; not just the machine with your Avid licence. However, certain features of the Avid Op-Atom MXF wrapper are either not yet tested, or not available. For these features, I still advise using the bmxlib suite.

The advantage of this method is that video and audio data is very quickly imported into your Avid, at the full rate that the FFmpeg encoder can manage. Furthermore, your Avid will be using its native formats (e.g. DNxHD), rather than converting, say, XAVC on-the-fly with the AMA functions. The disadvantage is that metadata is quite messy, and lacking certain elements altogether, until I’ve figured out the full MXF Op-Atom metadata tags. Particularly, audio and video tracks are not linked into a single multi-track clip in an Avid bin: you must synchronise them yourself.

So, in this article, I will show you how to take video and/or audio from any format that FFmpeg will read, and output immediately MXF files in Avid-friendly codecs that Avid Media Composer’s “Media Tool” will pick up for you.

This post shows my earliest tests. I have not yet fully explored how to link files, or add other attributes, that raw2bmx adds or, indeed, Avid’s own import and capture tools add. However, the advantage of not using raw2bmx is a much faster import process.

Here, we start with a file of any format with a mono soundtrack, and output Avid DNxHD files at a resolution of 1280×720 and a bit-rate of 90Mbit/s, straight into the Avid MediaFiles directory, and ready for editing. This workflow assumes the frame-rate is for UK television, at 25fps, progressive encoding. I have not attempted to detect the number of audio channels in use, and therefore they are not encoded separately. This is, however, easy to achieve by using FFmpeg’s “asplit” audio filter and is detailed on the FFmpeg website.

ffmpeg -i "MY_CLIP.f4v" -vf scale=1280:720:lanczos -an -metadata project="MY PROJECT" -metadata material_package_name="MY CLIP" -b:v 90M -f mxf_opatom "M:\Avid MediaFiles\MXF\1\MY_CLIP_v1.mxf" -vn -metadata project="MY PROJECT" -ac 1 -ar 48000 -metadata material_package_name="MY CLIP" -f mxf_opatom "M:\Avid MediaFiles\MXF\1\MY_CLIP_a1.mxf"

Here is a break-down of that command line:

-i "MY_CLIP.f4v"

Here is the incoming clip.

-vf scale=1280:720:lanczos

We start with producing an output video MXF. Here, we ensure that the video is resized to the particular flavour of HD we’re editing in. In this case, we’re using 720p, and resizing using the algorithm I consider to be the best.

-an

The video output can contain only one track: video, in this case. This command instructs that the output must contain no audio. (Literally: “audio, none”)

-metadata project="MY PROJECT"

Here, we embed into the MXF metadata a value for “project”. This corresponds to your Avid project name. It is true that, upon analysing Avid’s own MXF files, the project name is contained within the metadata tag “project_name”, but my shorter tag appears also to work.

-metadata material_package_name="MY CLIP"

This is the name of your clip, as it will appear in your Avid bins and in the Media Tool.

-b:v 90M

Here, set the bit-rate. Using FFmpeg’s built-in DNxHD encoder, you can choose from several bit-rates, which FFmpeg’s error messages will be happy to tell you about if you set this wrongly. We don’t explicitly set the encoder itself, because FFmpeg does that for you: its default for this muxer is DNxHD.

-f mxf_opatom

This explicitly instructs FFmpeg to wrap your data in an Op-Atom MXF wrapper, ready for your Avid Media Composer to use.

"M:\Avid MediaFiles\MXF\1\MY_CLIP_v1.mxf"

Finally, for the video file, here is the output file. In this case, I’m putting it straight into Avid’s media file storage area on my ‘M’ drive, for media. There is a "_v1" suffix so that the file is marked as a video file, for my own ease of comprehension.

-vn

After the video output file is named, we start listing the options for encoding the audio file. This first option instructs FFmpeg to produce an audio-only MXF file, without a video track. (Literally: “video, none”)

-metadata project="MY PROJECT"

As with the video file, we embed into the metadata the name of the Avid project that needs this file.

-metadata material_package_name="MY CLIP"

As above, this is the clip name as it will appear in your Avid bins or Media Tool.

-ac 1

This is a quick-and-dirty kludge to mix down all the incoming audio tracks to a single track. In real life, you’ll want to use FFmpeg’s filter “asplit” to handle each incoming audio track separately. At the moment, this command line produces only a single audio file, mixing together all incoming tracks.

-ar 48000

With this command, we convert the sample-rate of the incoming audio to the standard sampling rate for television: 48,000 samples per second. Avid can, of course, convert sample rates on-the-fly while editing, but it is better to perform this work at the import stage to give Avid less to do when editing. Again, the codec itself (pcm_s16le, meaning linear PCM, 16-bit, little-endian) is not explicitly specified because FFmpeg sets this as the default for Avid import.

-f mxf_opatom

As before, this explicitly instructs FFmpeg to wrap your data in an Op-Atom MXF wrapper, ready for your Avid Media Composer to use.

"M:\Avid MediaFiles\MXF\1\MY_CLIP_a1.mxf"

Here is the filename for the audio output. In this example, I have placed it in the same directory as the video output created earlier in this command line. It is suffixed with "_a1" for my own ease of comprehension.

There are additional options associated with this FFmpeg muxer, which are listed here. I have not experimented with these, but can see that the -mxf_audio_edit_rate might need to be adjusted for non-European television or film work e.g. 30000/1001 for American television work, or 24 or 24000/1001 for 24fps film work. Also, you would probably want to set the -signal_standard bt601 or -signal_standard 1 for standard definition television work.

Muxer mxf_opatom [MXF (Material eXchange Format) Operational Pattern Atom]:

Common extensions:
mxf
Mime type:
application/mxf.
Default video codec:
dnxhd.
Default audio codec:
pcm_s16le.

MXF-OPAtom muxer AVOptions:

-mxf_audio_edit_rate
Audio edit rate for timecode (from 0 to INT_MAX) (default 25/1)
-signal_standard
Force/set Sigal Standard (from -1 to 7) (default -1)
bt601
ITU-R BT.601 and BT.656, also SMPTE 125M (525 and 625 line interlaced)
bt1358
ITU-R BT.1358 and ITU-R BT.799-3, also SMPTE 293M (525 and 625 line progressive)
smpte347m
SMPTE 347M (540 Mbps mappings)
smpte274m
SMPTE 274M (1125 line)
smpte296m
SMPTE 296M (750 line progressive)
smpte349m
SMPTE 349M (1485 Mbps mappings)
smpte428
SMPTE 428-1 DCDM

“To Float Among the Centuries”

Harold & Lillian — A Hollywood Love Story

Honesty is sometimes the best policy. When a marriage in infamously fickle Hollywood survives for sixty years — as it did for the protagonists of this documentary — the magic combination of perseverance, optimism and honesty is well-rewarded by an honest telling of the story. Director Daniel Raim manages this not only in his interviewing technique, pulling in genuine tributes from A-listers including Danny DeVito (executive producer of this film), but also more subtly in his approach to constructing what might otherwise be an uncritical paean to a highly talented couple.

Against considerable odds, amusingly and refreshingly related on camera by Lillian, mid-20th-century American society finally permitted Harold Michelson to marry her and take her across the nation to Hollywood, where Harold’s career as an artist was intermittently moving forward. His talent was picked-up in World War II, when his paintings created during his time as a gunner in aircraft were noticed by his commanding officer. The skill of combining art with the precision of understanding angles of view as seen through a gun-sight translated perfectly to the optics of Hollywood cameras. Throughout Harold’s career as a storyboard artist then as a production designer, directors could not get enough of his visualisations of scripts that allowed cinematographers quickly to create iconic scenes that have gone down in history. It is his idea that saw a young Dustin Hoffman viewed through the triangle created by Mrs. Robinson’s legs, and it was Harold who gave us the commanding of the Red Sea’s turbulent obedience in “The Ten Commandments”. In fact, from the 1950s to “Star Trek”, it is impossible to overstate the influence of his art — often uncredited — on our collective movie memories.

Lillian’s first steps into motherhood in her new life with Harold are painfully documented by her exposĂ© of once-fashionable treatments available to her autistic child, while her feminism shines through as she fights against the confinement that 1950s mothers were expected to suffer in a male-dominated society. Her breakout discovery of a volunteering opportunity in a film studio research library was the start of another career of great influence in film-making: she became the unofficial dean of accurate research over many decades of famous movies. When a ballroom needed re-creating, Lillian’s library had the answers; when war scenes needed to be shot, her shelves of expertly-catalogued books showed exactly how to make each uniform and each prop. And when one studio would decide it no longer needed a comprehensive research library, Lillian’s reputation and persuasive skills would find it another home. If this lovingly-curated collection were to be broken-up in Lillian’s retirement, the film industry would lose its great Library at Alexandria.

The director’s good sense allows us to spend much time with both Harold (in well-respected archive footage) and Lillian, through whose attractive personalities many stories are told whose value last far beyond the end of the screening. Lillian’s observation of Tom Waits’ conversation as, “everything that came out him sounded like it should be a police confession”, and her delight in using her library to “float among the centuries” are nuggets that give hope to anyone beginning a career in a supporting role.

I will turn to the evidence of honesty, and its subtlety, in a moment. But first, Daniel Raim’s talent rises far above the genre of legacy films, in that he not only takes the trouble to discover the lessons that Harold and Lillian leave behind for all people who seek successful relationships, but also commissions sympathetic contributions from the cream of Hollywood’s directing and artistic talent who have lined up to be interviewed. Perhaps their motive is not entirely altruistic, because the strengths of the Michelsons, if rediscovered in younger form, would serve another two generations of film-makers well.

However, more than merely the icing on the visual cake is the work of modern-day artist Patrick Mate, whose frequent storyboard-style drawings of our protagonists’ real-life story resoundingly capture Lillian’s charm and personality, and simultaneously reflect Harold’s habits, practical nature and sometimes salty comments. This art is worth a book of its own.

Illustrating the honesty of the medium of film is difficult to manage subtly, but director Raim achieves this by allowing the cracks to show just sufficiently. He demonstrates the point that film-makers use artifice to suspend disbelief, but sometimes it must not interrupt the truth of the documentary. For example, jump-cuts are permitted in vision, so we are aware that sound-bites are constructed to allow reality to fit into the short spaces of our busy lives. The lavalier microphones are visible in-shot, rather than hidden beneath clothing, so we are reminded we are observers on a formal documentary film set, not merely guests invited to tea. Occasionally, the camera wobbles (it is easy to nudge a tripod in a small room), but the shot is not cut around; and footage taken from the Internet or from preview sources has not been replaced by the raw clips, possibly a measure to save thousands of dollars in budget without destroying the impact of the images. These are few and far between.

Although visual thrills are not the point of Raim’s documentary, there are enough great viewing and listening pleasures for an audience to be grateful for the honest manner of telling this story of hard work, hard talent, social history, and glimpses behind the edges of the proscenium arch. If storyboard artists, production designers and researchers have not been sufficiently acknowledged before, the top directors in this film might be starting to assuage their guilt on screen for all our pleasures in this documentary.

Harold & Lillian — A Hollywood Love Story (official site)

Showing Stream Structure with FFmpeg

Ever wondered what the structure of your H.264 or other motion-predicted video stream is? With FFmpeg and a Unix (e.g. Linux, BSD, Cygwin) command line, you can find out.

ffprobe -show_frames -select_streams v:0 YOURFILE.EXT | grep pict_type | sed s/pict_type=// | tr -d '\n'

The output is something like this:

IPPPPPPPPPPPPPPPPIPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPIIPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPIPPPPPPPPBPBBBPBBBPBBBPBBBPBBBPBBBPPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPPIBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPPBBBPBBBPBBBPBBBPBBPIBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBPBBPBPBPBPBPBPPPPPPPPBBBPBBBPBBBPBBBPBBBPBBBPPIIBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPBPIPPPBPPPPPPPPPPPPPPPPPPPPPPPPPPIIBPPBPBPPPBPBPBPBPPPBPBPBPBPBPPBPPBPPPBPBPPBPBPPPBPBPBPPBPPPBPBPBPPPIBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPBBBPIBBBPBBBPBBBPBBBPBBBPIBBPB...

Open Source MPEG2 Video Encoding for DVD

An open-source codec project, x262, is attempting to bring the best of x264’s coding techniques to the encoding of MPEG2 video. X264 is a very popular, world-class open-source H.264 encoder.

The open-source multimedia utility FFmpeg has its own MPEG2 video encoder, but its quality falls far behind that of x264. However, whilst it is possible to incorporate x262 within FFmpeg, one then loses the ability to compile-in the most up-to-date x264 encoder.

This is because the x262 project generates a library and a commmand-line utility that replaces x264, and extends its capabilities. Unfortunately, x262 isn’t tracking the latest x264 encoder right now, so it is best compiled as a separate utility.

In my own compilation of FFmpeg and associated utilities, I have kept x262 and x264 separate, so this blog post will show how to encode for DVD using x262 and FFmpeg, fully retaining FFmpeg’s x264 capabilities, and encoding MPEG2 video at greater quality than FFmpeg’s native encoder for this.

Here is the command-line, as set up for a 25FPS production converting the video from a 24fps cinema file. This is for video only. You’ll use a separate command line for audio, then combine the two files, again using FFmpeg.

To explain:

-r 25
Tell FFmpeg to interpret the file as 25fps, so we get the 24->25 speed up necessary when showing a cinema film on European television.
-vf scale=720:576:lanczos,smartblur=1.0:-0.4,colormatrix=bt709:bt601,setdar=16/9,setsar=64/45
This is a video filter, and it does quite a lot. First, we scale the film to PAL DVD spec, that is 720 x 576 pixels, and we use the lanczos algorithm for best quality. Then, using FFmpeg’s smartblur algorithm, we add a little inverse blur, to sharpen the image without increasing noise too much. Next, the colour matrix is converted, because we’re coming out of Rec.709 colourspace (standard for HD television), and going into Rec.601 colourspace, for standard definition television. Finally come two filters that signal the display aspect ratio, and the sample aspect ratio. These are the standard widescreen aspect ratios for the screen and each pixel in 576i television.
-an
This ensures that there is no attempt to process audio.
-pix_fmt yuv420p -f yuv4mpegpipe - |
The video’s pixel format is changed to yuv420 if it was not in this format to begin with, and we pipe the video out using the yuv4mpeg format, which carries a simple header to instruct the program at the end of the pipe to interpret the video correctly.
x262 --fps 25 --demuxer y4m --mpeg2
These set up the x262 encoder to interpret the pipe’s input correctly using the y4m format, and insist that the frame-rate is 25fps. Then, we instruct x262 to behave as an MPEG2 encoder. This is necessary because the x262 binary also contains an H.264 encoder.
--preset placebo
This preset sets up some of x262’s slowest, and most careful, encoding options. It slows the encoder down to around 7fps on an ancient laptop (the test machine here), but this is not a particular problem for my purpose.
--open-gop
By permitting each group of pictures to contain B-frames that can refer to P-frames outside their own GOP, there is a slightly increased efficiency of encoding.
--tune film
This sets some tunings that result in less apparent distortion to the picture when encoding from a film or film-like source
--keyint 12
DVD specification for PAL discs requires that each group-of-pictures be 15 frames long or less. This parameter ensures this is the case. GOPs can be much longer, but discs encoded with GOPs of more than 12 frames might not play on all players.
--fake-interlaced
Interlaced encoding is less efficient than progressive encoding. But if your incoming source is progressive, you can instruct the encoder in this way to encode it as if it were progressive footage, but still signal that it is interlaced in order to stay within what most DVD players expect.
--vbv-maxrate 8800 --vbv-bufsize 1835 --crf 1
Here is our bit-rate control. DVDs must never exceed 9,800kbit/s, so we allow up to 1,000kbit/s for audio and other overheads. Then we allow buffering up to 1,835kbits, which is the DVD player specification; and finally instruct the encoder to encode using the highest quality variable bit-rate within these parmeters.
--range tv --colorprim bt470bg --transfer bt470bg --colormatrix bt470bg
These define, and signal in the encoder’s output bitstream, the colour parameters of the video. In particular, these state that the signal’s range is that used for television (16-235 for luminance (Y), 16-240 for Cr and Cb for in 8-bit systems), and that the colour descriptions fit the Rec.601 standard, which is an update of BT.470BG
--sar 16:9
SAR means “Sample Aspect Ratio”: in other words, the pixel’s aspect ratio. In television, this should really be called “Display Aspect Radio”, because it describes the playback display aspect ratio, not the pixel. But it is so named in x262.
-o FILENAME.vob
Here, the output filename is given. We give it a VOB extension, because it is a Video OBject, as required by the DVD specification. Of course, at this stage, it contains video only until we add an MPEG stream containing sound in the next step, which is another blog post.
-
Do not forget this dash! It instructs x262 to receive its input from a pipe and not a file.

Here is the complete command line just described. The output is an MPEG2 encoded video file, noticeably better in quality than a file of the same bandwidth produced by FFmpeg’s native MPEG2 encoder.

ffmpeg -r 25 -i 24FPS-FILM-FILE -vf scale=720:576:lanczos,smartblur=1.0:-0.4,colormatrix=bt709:bt601,setdar=16/9,setsar=64/45 -an -pix_fmt yuv420p -f yuv4mpegpipe - | x262 --fps 25 --demuxer y4m --mpeg2 --preset placebo --open-gop --tune film --keyint 12 --fake-interlaced --vbv-maxrate 8800 --vbv-bufsize 1835 --range tv --colorprim bt470bg --transfer bt470bg --colormatrix bt470bg --sar 16:9 --crf 1 -o FILENAME.vob -