Difference between revisions of "Video Codecs"

From TSG Doc
Jump to navigation Jump to search
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
We advise users to contact the Technical Support Group to discuss which codec and export settings are best suited for your video stimuli. This page functions only as reference.
 
We advise users to contact the Technical Support Group to discuss which codec and export settings are best suited for your video stimuli. This page functions only as reference.
 +
 +
For a guide on recording your screen, see [[Screen Recording with OBS]].
  
 
== Information ==  
 
== Information ==  
Line 16: Line 18:
  
 
Bitrate can be set to Constant (CBR) or Variable (VBR). A variable bitrate can help decreasing file size when your video has a combination of high and low amounts of movement, as it will optimize the distribution of information storage for those parts in your video. The downside is that your video player has to sometimes suddenly decode a lot more information than the previous frame, potentially causing laggy playback. For this reason, we advise using a constant bitrate.
 
Bitrate can be set to Constant (CBR) or Variable (VBR). A variable bitrate can help decreasing file size when your video has a combination of high and low amounts of movement, as it will optimize the distribution of information storage for those parts in your video. The downside is that your video player has to sometimes suddenly decode a lot more information than the previous frame, potentially causing laggy playback. For this reason, we advise using a constant bitrate.
 +
 +
=== HEVC ===
 +
High Efficiency Video Coding (HEVC, also known as H.265) is the successor to H.264. Together with AVC, VP9 and AV1, it is one of the latest standards that yield significantly better compression rates than H.264. However, support is still far from universal and you may experience performance issues in some programs or on some devices. Therefore, we do not advise storing your videos in these formats unless it is for archival purposes only.
  
 
== Software support ==
 
== Software support ==
Line 25: Line 30:
 
|-
 
|-
 
| Codec
 
| Codec
! scope="row" colspan="1" | VP8/VP9
+
| style="text-align: center;" | VP8/VP9
! scope="row" colspan="1" | Theora
+
| style="text-align: center;" | Theora
! scope="row" colspan="2" | H.264
+
| style="text-align: center;" colspan="2" | H.264
! scope="row" style="width:120px;" | XVID
+
| style="text-align: center;" | XVID
 
|-
 
|-
 
| Container  
 
| Container  
! scope="row" | .webm .mkv
+
| .webm .mkv
! scope="row" | .ogv .ogg
+
| .ogv .ogg
! scope="row" | .mp4
+
| .mp4
! scope="row" colspan="2" | .avi
+
| colspan="2" | .avi
 
|-
 
|-
 
| Advantage
 
| Advantage
Line 40: Line 45:
 
| Open Source
 
| Open Source
 
| Industry Standard
 
| Industry Standard
| Works in Presentation  
+
| colspan="2" | Works in Presentation  
|
 
 
|-
 
|-
! scope="row"| Software
+
! Software
 
|-
 
|-
 
| Chrome/Firefox/Opera
 
| Chrome/Firefox/Opera
Line 74: Line 78:
 
| style="background-color:#9F9;" | Yes
 
| style="background-color:#9F9;" | Yes
 
|}
 
|}
<sup>1</sup> Windows version requires careful installation.<br/>
+
<sup>1</sup> Windows version requires careful installation, ask the TSG for help.<br/>
 
<sup>2</sup> Recommended output for Presentation only. See documentation below for conversion options.<br/>
 
<sup>2</sup> Recommended output for Presentation only. See documentation below for conversion options.<br/>
 
Note: This list is incomplete and will be updated as soon as we have tested all the common and recommended video formats with all supported stimuli software.
 
Note: This list is incomplete and will be updated as soon as we have tested all the common and recommended video formats with all supported stimuli software.
Line 80: Line 84:
 
== Neurobs Presentation ==
 
== Neurobs Presentation ==
  
Neurobs Presentation does not support the .mp4 container, so you will have to convert your H.264 encoded .mp4 videos to the .avi container. Neurobs recommends using MP4Cam2AVI Easy Converter<ref>http://www.neurobs.com/wiki/Presentation/Video#Video_Encoding</ref>. Be sure to uncheck 'preview On' before opening your files, because the program might crash otherwise. Alternatively, if your videos are under 5 minutes, you can use Freemake instead. Both programs can be downloaded via the links below.
+
Neurobs Presentation does not support the .mp4 container, so you will have to convert your H.264 encoded .mp4 videos to the .avi container. We recommend doing this with [[FFmpeg]].
 +
 
 +
Neurobs recommends using MP4Cam2AVI Easy Converter<ref>http://www.neurobs.com/wiki/Presentation/Video#Video_Encoding</ref>. Be sure to uncheck 'preview On' before opening your files, because the program might crash otherwise.
  
=== Freemake Settings ===
+
 
[[File:Freemake_presentation_settings.png|thumb|300px|Acceptable Freemake settings for Neurobs Presentation.]]
+
{{Warn|There are performance issues with playing videos in Presentation. Please contact the TSG if you plan to use videos in your Presentation experiment.}}
The following settings have been tested to work with Neurobs Presentation, but your mileage may vary.
 
# Load your video(s) into Freemake
 
# Click on the ''to AVI'' button
 
# Under ''Preset'', select '''Custom''' and click the ''Add your preset'' icon below
 
#* Set ''Video codec'' to '''H.264'''
 
#* Set ''Frame size'' and ''Frame rate'' to '''Original'''
 
#* Set ''Bitrate type'' to '''Custom''' and enter the target [[Video_Codecs#Bitrate|bitrate]]. Though in most cases, leaving it on '''Auto''' is fine too.
 
#* If your video contains audio, check the ''Audio'' checkbox
 
#* Set ''Audio codec'' to '''PCM'''
 
#* Set ''Channels'' to '''Stereo''', unless you know what you're doing
 
#* Set ''Sample rate'' to '''44100 Hz''', unless you know what you're doing
 
#* Set ''Sample size'' to '''16 bit''', unless you know what you're doing
 
#* Name your preset so you can find it again for video conversions. Note that different videos may require different bitrates, so don't blindly apply this profile to all videos.
 
# Set the path to which you want to save your converted video under ''Save to''.
 
# For a more optimal compression, change ''One-pass encoding (high speed)'' to '''Two-pass encoding (low speed)'''. Like the names suggest, two-pass encoding takes a bit longer.
 
# Click the ''Convert'' button to start converting your videos!
 
# ????
 
# Profit<ref>http://knowyourmeme.com/memes/profit</ref>.
 
  
 
== Downloads ==
 
== Downloads ==
 
=== Converters ===
 
=== Converters ===
 +
We recommend using [[FFmpeg]] for encoding/converting your videos. If you prefer using a GUI for converting to mp4, Handbrake is a decent option.
 
{| class="wikitable"   
 
{| class="wikitable"   
 
|-
 
|-
Line 111: Line 100:
 
! scope="col" | Supported formats
 
! scope="col" | Supported formats
 
! scope="col" | Supported containers
 
! scope="col" | Supported containers
 +
|-
 +
| [[FFmpeg]] || https://ffmpeg.org/ || various || any
 
|-
 
|-
 
| Handbrake || https://handbrake.fr/ || H.264, MPEG-4, MPEG-2, VP3 || mp4, mkv
 
| Handbrake || https://handbrake.fr/ || H.264, MPEG-4, MPEG-2, VP3 || mp4, mkv
|-
 
| Freemake<ref>Freemake adds a watermark to videos longer than 5 minutes. Also beware of adware during install.</ref> || http://www.freemake.com/ || H.264, MPEG-4, XVID, MPEG-2, MPEG-1, WMV3, FLV || avi, wmv, mpeg, mp4, 3gp, mkv, flv, swf, webm
 
 
|-
 
|-
 
| MP4Cam2AVI Easy Converter || http://sourceforge.net/projects/mp4cam2avi || H.264 || avi, mp4
 
| MP4Cam2AVI Easy Converter || http://sourceforge.net/projects/mp4cam2avi || H.264 || avi, mp4
 
|}
 
|}
  
 +
<!--
 
=== Codec Packs ===
 
=== Codec Packs ===
Note: Below is just a list of several codec packs. Please do not attempt to install all packs together, but only choose the one(s) your playback-software requires.
+
Note: Below is just a list of several codec packs. Please '''do not attempt to install all packs together''', but only choose the one(s) your playback-software requires.
 
{| class="wikitable"   
 
{| class="wikitable"   
 
|-
 
|-
Line 131: Line 121:
 
|-
 
|-
 
| K-Lite Codec Pack || http://www.codecguide.com/download_kl.htm
 
| K-Lite Codec Pack || http://www.codecguide.com/download_kl.htm
|-
 
| FFmpeg Encoder || https://www.ffmpeg.org/
 
 
|-
 
|-
 
| FFDshow || http://sourceforge.net/projects/ffdshow-tryout/
 
| FFDshow || http://sourceforge.net/projects/ffdshow-tryout/
 
|}
 
|}
 +
-->
 +
=== Codec Viewer ===
 +
Want to know how a video was encoded? You can use MediaInfo (open-source, at https://mediaarea.net/en/MediaInfo) to gain insight into the video and audio codecs, bit rates, resolution, frame rate, etc.
  
 
=== Media Players ===
 
=== Media Players ===

Latest revision as of 16:19, 21 March 2024

We advise users to contact the Technical Support Group to discuss which codec and export settings are best suited for your video stimuli. This page functions only as reference.

For a guide on recording your screen, see Screen Recording with OBS.

Information

Codecs

To find out what video codecs are and why they are used, grab a cup of coffee (or other non-alcoholic beverage of choice) and reserve about 45 minutes of your life to watch this comprehensive video: How Codecs Work (Vimeo).

Bitrate

When compressing a video, you will be asked to enter a 'bitrate'. This is what determines how much information is stored for every second of video. The more information, the higher the quality of the video. The tradeoff is file size. The more information, the larger the file. So setting a bitrate is striking a balance between limiting the file size without losing too much quality. The smarter the compression format, the easier this is to achieve.

If you are using H.264 compression, you can calculate a ballpark estimate for your target bitrate using the Kush gauge, a helpful formula written by a guy named Kush:

Target Bitrate (kbps) = Frame Width (px) * Frame Height (px) * Frame Rate (fps) * Motion Factor * 0.07 / 1000

"Motion Factor" is an arbitrary value (typically 1, 2 or 4) that you can assign to your video based on the amount of (fast) movement in the video. Higher amounts of movement require a higher amount of information to be stored in order to prevent quality loss. Example calculation for a typical 720p video:

1280 * 720 * 25 * 2 * 0.07 / 1000 = 3225.6 kbps (= 3.2 Mbps)

Bitrate can be set to Constant (CBR) or Variable (VBR). A variable bitrate can help decreasing file size when your video has a combination of high and low amounts of movement, as it will optimize the distribution of information storage for those parts in your video. The downside is that your video player has to sometimes suddenly decode a lot more information than the previous frame, potentially causing laggy playback. For this reason, we advise using a constant bitrate.

HEVC

High Efficiency Video Coding (HEVC, also known as H.265) is the successor to H.264. Together with AVC, VP9 and AV1, it is one of the latest standards that yield significantly better compression rates than H.264. However, support is still far from universal and you may experience performance issues in some programs or on some devices. Therefore, we do not advise storing your videos in these formats unless it is for archival purposes only.

Software support

Recommended formats Non-Recommended formats
Codec VP8/VP9 Theora H.264 XVID
Container .webm .mkv .ogv .ogg .mp4 .avi
Advantage Open Source Open Source Industry Standard Works in Presentation
Software
Chrome/Firefox/Opera Yes Yes Yes No
VLC Yes Yes Yes Yes Yes
PsychoPy Yes1 Yes1 Yes1
Neurobs Presentation No No No Yes2 Yes

1 Windows version requires careful installation, ask the TSG for help.
2 Recommended output for Presentation only. See documentation below for conversion options.
Note: This list is incomplete and will be updated as soon as we have tested all the common and recommended video formats with all supported stimuli software.

Neurobs Presentation

Neurobs Presentation does not support the .mp4 container, so you will have to convert your H.264 encoded .mp4 videos to the .avi container. We recommend doing this with FFmpeg.

Neurobs recommends using MP4Cam2AVI Easy Converter[1]. Be sure to uncheck 'preview On' before opening your files, because the program might crash otherwise.


Downloads

Converters

We recommend using FFmpeg for encoding/converting your videos. If you prefer using a GUI for converting to mp4, Handbrake is a decent option.

Name Download Location Supported formats Supported containers
FFmpeg https://ffmpeg.org/ various any
Handbrake https://handbrake.fr/ H.264, MPEG-4, MPEG-2, VP3 mp4, mkv
MP4Cam2AVI Easy Converter http://sourceforge.net/projects/mp4cam2avi H.264 avi, mp4

Codec Viewer

Want to know how a video was encoded? You can use MediaInfo (open-source, at https://mediaarea.net/en/MediaInfo) to gain insight into the video and audio codecs, bit rates, resolution, frame rate, etc.

Media Players

Name Download Location
VLC https://www.videolan.org/
Noldus Mainconcept Codec (Noldus Media Recorder) Media:Noldus MainConcept Codec Package 8.5.26.zip
AVBin (Psychopy) http://avbin.github.io/AVbin/Home/Home.html
Gstreamer (Matlab) http://gstreamer.freedesktop.org/

References