3

I'm sending a movie via email.

Will a file encoded with the ffmpeg's option libx264, be able to play back natively in Windows 8 without any external software?

ffmpeg -i in.avi -vcodec libx264 out.avi
3
  • AFAIK WMP, even with the Media Center Pack, does not support H.264 MKVs. Never has (not unless a codec pack with the required splitter etc. is installed). Don't think the Store Video app can handle MKVs either. H.264 MP4s should play back fine though.
    – Karan
    Nov 6, 2012 at 17:29
  • Is there any particular ffmpeg cmd line you are using, or do you want help in crafting one? Mp4 is a good container to use.
    – askvictor
    Nov 8, 2012 at 10:30
  • 1
    A codec will provide the algorithm for encoding the video (and a separate codec will do audio). A container does several things - it interleaves the audio and video (perhaps many streams of each, and subtitles), it adds information to allow the decoder to recover if the stream is corrupted (scratched disc, noisy transmission). Mp4, avi, mov, mkv, ogg, are containers, while mpeg, mpeg2, mpeg4, mp3 (actually mpeg 2, layer 3), vorbis, theora, vp3, aac are codecs. (mpeg4 is a bit confusing as it defines both codecs including h264, and a container)
    – askvictor
    Nov 8, 2012 at 10:40

3 Answers 3

6
+50

TL;DR:

  • Windows 8 can play x264-encoded video as long as it's in an MP4 or 3GP file (reference)
  • AVI files might work, but don't have to, because AVI doesn't support everything x264 offers.

For further info, I'll point you to the answer I've posted here: What is a Codec (e.g. DivX?), and how does it differ from a File Format (e.g. MPG)? This goes way beyond what I'm writing here, but for this question, we can narrow it down a little.

What is x264?

So, first of all, libx264 is an FFmpeg library that allows FFmpeg to encode video using the x264 encoder. x264 again is just one encoder that encodes video in the H.264 codec standard – also known as MPEG-4 Part 10 AVC / Advanced Video Coding. The codec ("encoder/decoder") simply specifies a standard that encoders and decoders have to adhere to.

Because there's just a codec standard, there are many other H.264 encoders apart from x264 such as Mainconcept or even a built-in one from FFmpeg. But x264 is free, open source, very efficient and delivers good quality, which is why it's used so often.

Why do we need a container?

x264 can only encode actual video. You could theoretically just store it in a .264 file, and it'd be a valid video bit/bytestream. No audio, no subtitles, etc. But often, you don't just want to watch video without audio. This is why we need to merge video, audio and subtitles in one file. This file is called the container, as it contains all the individual media tracks.

A container will synchronize video and audio frames according to their Presentation Time Stamp (PTS), which makes sure they are displayed at exactly the same time.

Popular containers these days include …

  • MP4, short for MPEG-4 Part 14, not to be confused with video codec standards such as MPEG-4 Part 2 video (e.g. XviD-encoded) or MPEG-4 Part 10 video (the H.264 we've talked about above, e.g. x264-encoded).

  • MKV, short for Matroska, a container that can include almost everything you feed it.

  • AVI, a really old container format that is supported almost anywhere, but doesn't support a lot itself. Don't use it unless you really have to.

To sum it up: Codecs are stored inside of a container. Codecs represent the actual media, and the containers just bundle them into one file. You could call them both "formats", but don't use that term because it's ambiguous.

4

x.264 is an H.264 / MPEG-4 Part 10 encoder. H.264 codecs are supported:

enter image description here

Source: Building a rich and extensible media platform - MSDN Blogs

4
  • So, if I send the file they will need to downoad media center? I wonder if IE10 can play it is as the encoder is supported by metro applications.
    – Mikhail
    Nov 6, 2012 at 8:25
  • No, it seems that the Windows Store Video application can play it, and it ships with all versions of Windows 8. Nov 6, 2012 at 16:59
  • 2
    @CalebJares: H.264 is a codec. Are you sure the container (such as MKV) will be supported? MKV =/= MP4, even though both can contain H.264 video streams.
    – Karan
    Nov 6, 2012 at 17:36
  • 1
    @Misha - this is a good answer but doesn't take the final step to say what you need to do. If you use ffmpeg and the libx264 codec to generate an MP4 container with H.264 video / AAC audio, then people will be able to play it on Windows 8. If you use the same application and codec to produce an MKV container, then without installing additional software, they won't.
    – PJC
    Nov 10, 2012 at 22:39
1

It should play in Windows Media Player by default (x.264 is an MPEG-4 Part 10 / AVC encoder, which is supported). However, Windows Media Player does not necessarily ship by default with Windows (I think this is due to antitrust issues in Europe).

Not quite related to your question, but why not consider hosting the file online (YouTube, Picasa/Google+, Flickr)? Then your recipient just needs a web browser.

3
  • That is a solid suggestion, but we are sending this clip to a publishing house.
    – Mikhail
    Nov 6, 2012 at 6:41
  • x264 is an encoder, not a format or a collection of specifications.
    – llogan
    Nov 6, 2012 at 7:32
  • askvictor, you can choose whether to buy the N version (without Media Player) or the regular one in Germany at least. If I remember correctly there were about 1000 sales of the Vista N back in the day which prompted Microsoft to sue the EU back because offering an SKU that isn't bought can hardly be called profitable. TL;DR: The N version isn't any default anywhere here. But it is sold if you want it desperately.
    – Joey
    Nov 8, 2012 at 6:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .