Skip to content

Instantly share code, notes, and snippets.

@belachkar
Last active March 21, 2023 18:43
Show Gist options
  • Save belachkar/c35fd2c4832d841970035b06019f3558 to your computer and use it in GitHub Desktop.
Save belachkar/c35fd2c4832d841970035b06019f3558 to your computer and use it in GitHub Desktop.
VLC command-line

VLC command-line

Convert video files to mp4 video files.

Using common parameters

  • -I: dummy Does not show the VLC GUI
  • -vvv: Gives you verbose output
  • --sout: Specifies the options to use when encoding to MP4
  • vlc://quit: Quitter VLC after finish.

Examples:

Single file

vlc file --sout='#transcode{vcodec=mp1v, vb=1024, acodec=mpga, ab=128}:std{access=file, mux=mpeg1, dst=C:\file_name.mpg}' vlc://quit

vlc -I dummy -vvv MyVid.mod --sout="#transcode{vcodec=h264,vb=1024,acodec=mp4a,ab=128,channels=2,deinterlace}:standard{access=file,mux=ts,dst=MyVid.mp4}" vlc://quit

vlc -I dummy -vvv AVSEQ01.DAT --sout="#transcode{vcodec=h264,fps=16,acodec=mp4a,deinterlace}:std{access=file,mux=mp4,dst=AVSEQ01.mp4}" vlc://quit

Multiple files using powershell

foreach($f in Get-ChildItem . -Filter *.DAT) {vlc -I dummy -vvv $f --sout="#transcode{vcodec=h264,acodec=mp4a,deinterlace}:std{access=file,mux=mov,dst=$f.mp4}" vlc://quit}
  • .: The folder (.: the current folder), to get al the files in the current folder with the exetnsion DAT.
  • -Filter .DAT: .DAT is the extension of the files to convert to mp4.

Transcode stream output (stream_out_transcode)

Video

  • --sout-transcode-venc={any,jpeg,png,x264,x265,opus,g711,araw,theora,vorbis,twolame,schroedinger,substx3g,webvtt,speex,flac,t140,avcodec,lpcm,dvbsub,vpx,rtpvideo,dmo,edummy,stats,qsv,none} Video encoder This is the video encoder module that will be used (and its associated options).
  • --sout-transcode-vcodec=string Destination video codec This is the video codec that will be used.
  • --sout-transcode-vb=integer Video bitrate Target bitrate of the transcoded video stream.
  • --sout-transcode-scale=float [-340282346638528859811704183484516925440.000000 .. 340282346638528859811704183484516925440.000000]> Video scaling Scale factor to apply to the video while transcoding (eg: 0.25)
  • --sout-transcode-fps=string Video frame-rate Target output frame rate for the video stream.
  • --sout-transcode-deinterlace, --no-sout-transcode-deinterlace Deinterlace video (default disabled) Deinterlace the video before encoding.
  • --sout-transcode-deinterlace-module={deinterlace,ffmpeg-deinterlace} Deinterlace module Specify the deinterlace module to use.
  • --sout-transcode-width=integer Video width Output video width.
  • --sout-transcode-height=integer Video height Output video height.
  • --sout-transcode-maxwidth=integer Maximum video width Maximum output video width.
  • --sout-transcode-maxheight=integer Maximum video height Maximum output video height.
  • --sout-transcode-vfilter=string Video filter Video filters will be applied to the video streams (after overlays are applied). You can enter a colon-separated list of filters.

Audio

  • --sout-transcode-aenc={any,jpeg,png,x264,x265,opus,g711,araw,theora,vorbis,twolame,schroedinger,substx3g,webvtt,speex,flac,t140,avcodec,lpcm,dvbsub,vpx,rtpvideo,dmo,edummy,stats,qsv,none} Audio encoder This is the audio encoder module that will be used (and its associated options).
  • --sout-transcode-acodec=string Destination audio codec This is the audio codec that will be used.
  • --sout-transcode-ab=integer Audio bitrate Target bitrate of the transcoded audio stream.
  • --sout-transcode-alang=string Audio language This is the language of the audio stream.
  • --sout-transcode-channels=integer [0 .. 9]> Audio channels Number of audio channels in the transcoded streams.
  • --sout-transcode-samplerate=integer [0 .. 48000]> Audio sample rate Sample rate of the transcoded audio stream (11250, 22500, 44100 or 48000).
  • --sout-transcode-afilter=string Audio filter Audio filters will be applied to the audio streams (after conversion filters are applied). You can enter a colon-separated list of filters.

Codecs

Video Codecs

Use the "name" part in your vcodec=... commands

name description
mp1v MPEG-1 Video - recommended for portability
mp2v MPEG-2 Video - used in DVDs
mp4v MPEG-4 Video
SVQ1 Sorenson Video v1
SVQ3 Sorenson Video v3
DVDv VOB Video - used in DVDs
WMV1 Windows Media Video v1
WMV2 Windows Media Video v2
WMV3 Windows Media Video v3, also called Windows Media 9 (unsupported)
DVSD Digital Video
MJPG MJPEG
H263 H263
h264 H264
theo Theora
IV20 Indeo Video
IV40 Indeo Video version 4 or later
RV10 Real Media Video
cvid Cinepak
VP31 On2 VP3
FLV1 Flash Video
CYUV Creative YUV
HFYU Huffman YUV
MSVC Microsoft Video v1
MRLE Microsoft RLE Video
AASC Autodesk Animator Studio Codec RLE Video
FLIC FLIC video
QPEG QPEG Video
VP8 VP8 Video

Audio Codecs

Use the "name" part in your acodec=... commands

name description
mpga MPEG audio (recommended for portability)
mp3 MPEG Layer 3 audio
mp4a MP4 audio
a52 Dolby Digital (A52 or AC3)
vorb Vorbis
opus Opus
spx Speex
flac FLAC

Muxers

Use the "name" part in your mux=... commands

name description
mpeg1 MPEG-1 multiplexing - recommended for portability. Only works with mp1v video and mpga audio, but works on all known players
ts MPEG Transport Stream, primarily used for streaming MPEG. Also used in DVDs
ps MPEG Program Stream, primarily used for saving MPEG data to disk.
mp4 MPEG-4 mux format, used only for MPEG-4 video and MPEG audio.
avi AVI
asf ASF
dummy dummy output, can be used in creation of MP3 files.
ogg Xiph.org's ogg container format. Can contain audio, video, and metadata.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment