54

How can a set of WMV files be converted to MP4 so I can import them to my Apple TV?

9 Answers 9

79

You can use FFmpeg (a free command-line tool for Mac, Linux and Windows) to encode WMV to MP4. Here is an example syntax:

ffmpeg -i input.wmv -c:v libx264 -crf 23 -c:a aac -q:a 100 output.mp4

This will encode the video to H.264 video and AAC audio, using the default quality. To change the quality for the video, use a different CRF value, where lower means better, e.g. 20 or 18. For audio, 100% is the default quality. Increase the value for better quality.

For the AppleTV specifically, this is what Apple says it supports:

H.264 video up to 1080p, 30 frames per second, High or Main Profile level 4.0 or lower, Baseline profile level 3.0 or lower with AAC-LC audio up to 160 kbit/s per channel, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats

So, you could use the following command to force the 30 Hz frame rate and High profile:

ffmpeg -i input.wmv -c:v libx264 -crf 23 -profile:v high -r 30 -c:a aac -q:a 100 -ar 48000 output.mp4
5
  • 10
    I just tried using this solution on Fedora 19 and ran into the error: Unknown encoder 'libaac' It seems that after a certain release, ffmpeg does not include binary distibutions with libfaac support, so you would need to build from source. Instead I changed 'libfaac' to 'aac' and added the '-strict -2' flags and the conversion worked successfully.
    – roartechs
    Jan 6, 2014 at 8:10
  • 4
    Unrecognized option 'c:v' Failed to set value 'libx264' for option 'c:v'
    – e-info128
    Feb 11, 2014 at 18:36
  • 9
    i had the exact same issues as roartechs and solved them using ffmpeg -i input.wmv -c:v libx264 -crf 23 -c:a aac -strict -2 -q:a 100 output.mp4 Nov 8, 2016 at 14:20
  • warning, in most cases, 23 is significantly different from 20 whereas 22 is barely noticeable, and 18 is hard to spot any differences at all from original.
    – Dmytro
    Apr 6, 2019 at 4:06
  • For some reason resulting file was 6(!!!!) times bigger than iriginal WMV with screen recording. 2 days ago
21

HandBrake. Multi-platform and free.

HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder, available for MacOS X, Linux and Windows.

Supported Sources:

  • Most common multimedia files that libavformat and libavcodec support.

  • Any DVD or Bluray-like source which is NOT copy-protected. (removal of copy protection is not supported)

Outputs:

  • File format: MP4(M4V) and MKV

  • Video: H.264(x264), MPEG-4(ffmpeg), MPEG-2(ffmpeg), or Theora(libtheora)

  • Audio: AAC, CoreAudio AAC/HE-AAC (OS X Only), MP3, Flac, AC3, or Vorbis. AC-3, DTS, DTS-HD, AAC and MP3 pass-thru.

6
  • 2
    HandBrake didn't work. I received an error that says "No Title(s) found. Please make sure you have selected a valid, non-copy protected source. Your source may be copy protected, badly mastered or a format which Handbrake does not support." and I don't think HandBrake supports wmv.
    – burnt1ce
    Nov 21, 2009 at 20:17
  • 8
    Sorry to hear. It passed the "Works on my machine" test :-(.
    – user3463
    Nov 21, 2009 at 21:28
  • Worked for me with Handbrake 0.9.4.
    – Sebastian
    Aug 1, 2012 at 20:16
  • @RandolphWest What is your machine, if it worked on it?
    – bwerks
    Dec 27, 2012 at 19:24
  • @burnt1ce After getting the exact same error, I was able to convert a GoToMeeting wmv using Handbrake only after first transcoding with Citrix's g2mtranscoder.exe, and then using Handbrake 0.9.8.
    – bwerks
    Dec 28, 2012 at 21:00
5

If you're trying to convert WMV files created by GoToMeeting (aka Go2Meeting for SEO purposes) then all of the above solutions will probably fail because the video is encoded using a citrix-specific g2m4 codec that will make transcoders choke.

I found this page that guides through transcoding from g2m to regular WMV using g2mtranscoder.exe provided by gotomeeting, which will transcode your video in place so that you can then transcode it to your format of choice using regular tools (like the other answers in this thread).

2
  • Are you sure that FFmpeg doesn't do GoToMeeting codecs? It's listed in ffmpeg -codec, however with no D flag, so I don't know if it's fully supported.
    – slhck
    Dec 28, 2012 at 20:17
  • @slhck I did try FFmpeg on its own as a first step, and while it did identify the video codec as Video: g2m (G2M4 / 0x344D3247), it resulted with error 'Unable to parse option value "-1" as pixel format'. After in-place transcoding with g2mtranscoder, I was then able to transcode normally with handbrake. I do plan on trying to get it working with FFmpeg though so I can full automate this process.
    – bwerks
    Dec 28, 2012 at 20:56
2

www.media-convert.com is a free web based service that converts all sorts of audio and video formats. No need to install any software. Ignore the adds and just select the file type from the dropdown menus.

2
  • 1
    Very interesting however, it doesn't output 720p+ quality video. Max resolution for mp4 is 640x480. But +1 for sure.
    – burnt1ce
    Nov 21, 2009 at 23:32
  • But they would own copies of your files after this, which is not good, if you doing something more important than meme videos. 2 days ago
1
./ffmpeg -y -i input.wmv -vcodec libx264 -acodec libfaac -ab 128k -ac 2 -b 300 -threads 4 -flags +loop -cmp +chroma -partitions 0 -subq 1 -trellis 0 -refs 1 -coder 0 -bufsize 10M  -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 output.mp4

I don't know what all the options/flags mean, but that seemed to work and get a Flash streamable MP4 file, but the video was not top quality.

The the codec libraries I have installed are libx264 and libfaac for H.264 and AAC video and audio codecs.

1

MediaCoder should do the job just fine!

MediaCoder is a free universal media transcoder since 2005. It integrates most popular audio/video codecs and tools in an elegant and transparent manner into an all-in-one transcoding solution. With a flexible and extendable architecture, latest codecs and tools are updated added in constantly. MediaCoder intends to be the swiss army knife for media transcoding in all time.

1
  • Cool i'm downloading it now.
    – burnt1ce
    Nov 21, 2009 at 20:29
1

Try Any Video Converter. As the name suggests, it can convert many kinds of videos.

2
  • this is the not-free one... Nov 21, 2009 at 19:14
  • 1
    actually, there is a free version
    – phunehehe
    Nov 22, 2009 at 5:51
0

I would use MediaCoder for batch conversion or other user-friendly possibility is Avidemux.

0

I couldn't install FFmpeg on Ubuntu Server 14.10 (Utopic Unicorn), so I used HandBrake. After installation I've used a script from thanhsiang.org/faqing:

  1. Create a .sh file, for example, convert.sh
  2. chmod +x convert.sh
  3. Configure SRC and DEST directories, + DEST_EXT
  4. ./convert.sh

File convert.sh

#!/bin/bash

# This script is to convert automatically a folder of video files to MP4.
# You need to change SRC -- Sourse folder and DEST -- Destination folder
# The MP4 format is 480x270.

SRC=/home/video/
DEST=/home/www/mp4files/
DEST_EXT=mp4
HANDBRAKE_CLI=HandBrakeCLI

for FILE in `ls $SRC`
do
        filename=$(basename $FILE)
        extension=${filename##*.}
        filename=${filename%.*}

        $HANDBRAKE_CLI -i $SRC/$FILE -o $DEST/$filename.$DEST_EXT -e x264 -q 22 -r 12 -B 64 -X 480 -O
done

It was the fastest solution for me.

You must log in to answer this question.

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