EzDevInfo.com

video-conversion interview questions

Top video-conversion frequently asked interview questions

Handbrake settings to convert MKV to MP4 while retaining the original quality

I have a ton of MKV files I need to convert to MP4 and my chosen software is Handbrake.

I'm stuck on which settings would be best for the conversion. I want to retain full quality. Do I just convert with the original settings and not change anything or is there any specific thing I need to change?


Source: (StackOverflow)

What is the easiest way to convert MPEG video to FLV format?

I have MPEG video (.mpg) that I would like to convert to FLV format for use in Flash players. What is the easiest (idiot-proof) way to do this on a Windows machine?


Source: (StackOverflow)

Advertisements

Convert videos to iPod Touch-friendly formats [closed]

I have a bunch of Xvid videos lying around, and I would love to convert them to a format that will play on my iPod touch efficiently and quickly.

What free programs can do this? Although I am after something to run on Leopard, Windows programs wouldn't be bad either.


Source: (StackOverflow)

VOB conversion quality in FFmpeg

I am trying to convert a VOB file to mpeg like this:

./ffmpeg.exe -i VTS_01_2.VOB -r 24  out1.mpeg

However, the quality is very poor.

I tried ./ffmpeg.exe -i VTS_01_2.VOB -vcodec copy out1.mpeg

But the file size is too large (90% of original – 300 MB for 4 minute video), and Windows Movie Maker hangs on trying to import it.

How can I get a decent quality MPEG from my VOB?


Source: (StackOverflow)

ffplay - how to play together separate video and audio files

So I am able to transcode separate video and audio files into one movie file, like so:

ffmpeg -ss 0 -lowres 0 -r 24 -i dcp/picture.mxf -vf "xyz2rgb" -i mov/sound.wav -ac 2 -ab 256k -vb 3000k -t 10 -y mov/movie.mp4

And see and hear the resulting movie like so:

ffplay -ss 0 -lowres 1 -vf "xyz2rgb" mov/movie.mp4

However, to avoid having to transcode the movie and sound together into one file before being able to see it, I would like to simply play the two separate files together. As far as I know, ffplay does not let you combine two different files (right?).

Reading these forums it seems that you can pipe an ffmpeg output to ffplay. The following is as close as I got. It's not that close. :( Video information is clearly being carried over, but it is green "snow" in the right frame size, with hints of the actual imagery dancing inside the horrible green snow. This way I know that something of the actual picture data is carrying over, just not rendering correctly. At all.

And no audio plays. The sound is not carrying over (I don't think.) Now... I'm stuck. The following suggests what I'm trying to do, but it's not working:

ffmpeg -ss 0 -lowres 0 -r 24 -i dcp/picture.mxf -vf "xyz2rgb" -i mov/sound.wav -f rawvideo - | ffplay -f rawvideo -vf "xyz2rgb" -s 1998x1080 -

Source: (StackOverflow)

Converting images to video using FFMPEG on Windows

I'm trying to convert a series of JPEG images into a time lapse video. They're in the format IMGP0001.JPG, IMGP0002.JPG, etc. From the looks of things, this should match the pattern IMGP%04.JPG.

I've tried the following commands (modified from the 2nd entry at this page):

ffmpeg -f image2 -i IMGP%04d.jpg video.mpg

I get the error "IMGP%04d.JPG: No such file or directory".

What am I doing wrong? Perhaps the syntax "IMGP%04d.JPG" is *nix specific? If so what would be the Windows equivalent?


Source: (StackOverflow)

Convert specific video and audio track only with ffmpeg

I have an MKV file (vidui.mkv) with 6 tracks in it.

Track 1 - video - xvid - 1920x1080
Track 2 - video - xvid - 720x576
Track 3 - audio -  AAC - 1240kbps - English
Track 4 - audio -  AAC - 648kbps - Spanish
Track 5 - audio -  AAC - 648kbps - Commentary 1
Track 6 - audio -  AAC - 648kbps - Commentary 2

I want to convert the above file to a mp4 format with one h264 video and one AC3 audio. Also I want to convert track 1 (video) and track 5(audio).

If I use

ffmpeg.exe -i vidui.mkv -f mp4 -vcodec libx264 -acodec ac3 -crf 20 -sn -n vidui.mp4

it converts the first video track and first audio track, but what I would like it to do is convert track 1 and track 5.


Source: (StackOverflow)

Why is converting WMV to MP4 so slow?

I am trying to convert a video from WMV to MP4 with FFmpeg but it takes couple of hours. If I try to convert it to AVI it only takes about 10-15 minutes.

ffmpeg version

ffmpeg version N-43206-gf857465
built on Aug  4 2012 16:10:39 with gcc 4.7.1 (GCC)

Conversion to MP4

ffmpeg -i input.wmv -vcodec libx264 output.mp4

libavutil      51. 66.100 / 51. 66.100
  libavcodec     54. 49.100 / 54. 49.100
  libavformat    54. 22.100 / 54. 22.100
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3.  5.102 /  3.  5.102
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, asf, from 'input.wmv':
  Metadata:
    WMFSDKVersion   : 12.0.7601.17514
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
    encoder         : Lavf54.22.100
  Duration: 01:14:23.06, start: 0.000000, bitrate: 324 kb/s
    Stream #0:0: Video: msmpeg4 (MP43 / 0x3334504D), yuv420p, 1280x720, 15 tbr,
1k tbn, 1k tbc
[libx264 @ 03427620] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle Cac
he64
[libx264 @ 03427620] profile High, level 3.1
[libx264 @ 03427620] 264 - core 125 r2208 d9d2288 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 scenec
ut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=
0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
  Metadata:
    WMFSDKVersion   : 12.0.7601.17514
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
    encoder         : Lavf54.22.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=-1--
1, 15 tbn, 15 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (msmpeg4 -> libx264)

Conversion to MP4 with copy

ffmpeg -i input.wmv -c:v:1 copy output.mp4

  libavutil      51. 66.100 / 51. 66.100
  libavcodec     54. 49.100 / 54. 49.100
  libavformat    54. 22.100 / 54. 22.100
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3.  5.102 /  3.  5.102
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, asf, from 'input.wmv':
  Metadata:
    WMFSDKVersion   : 12.0.7601.17514
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
    encoder         : Lavf54.22.100
  Duration: 01:14:23.06, start: 0.000000, bitrate: 324 kb/s
    Stream #0:0: Video: msmpeg4 (MP43 / 0x3334504D), yuv420p, 1280x720, 15 tbr,
1k tbn, 1k tbc
[libx264 @ 03437620] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle Cac
he64
[libx264 @ 03437620] profile High, level 3.1
[libx264 @ 03437620] 264 - core 125 r2208 d9d2288 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 scenec
ut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=
0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
  Metadata:
    WMFSDKVersion   : 12.0.7601.17514
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
    encoder         : Lavf54.22.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=-1--
1, 15 tbn, 15 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (msmpeg4 -> libx264)

Conversion to AVI with copy

ffmpeg -i input.wmv -c:v:1 copy output.avi

Input #0, asf, from 'input.wmv':
  Metadata:
    WMFSDKVersion   : 12.0.7601.17514
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
    encoder         : Lavf54.22.100
  Duration: 01:14:23.06, start: 0.000000, bitrate: 324 kb/s
    Stream #0:0: Video: msmpeg4 (MP43 / 0x3334504D), yuv420p, 1280x720, 15 tbr,
1k tbn, 1k tbc
Output #0, avi, to 'output.avi':
  Metadata:
    WMFSDKVersion   : 12.0.7601.17514
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
    ISFT            : Lavf54.22.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1280x720, q=2-31, 20
0 kb/s, 15 tbn, 15 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (msmpeg4 -> mpeg4)

Are there some additional parameters I need to pass?


Source: (StackOverflow)

What's the difference between FFmpeg's "-vcodec copy" and "-sameq"?

What is the difference between using -vcodec copy and -sameq with FFmpeg?

Do they do the same thing?


Source: (StackOverflow)

How to convert .avi video that has 1 static image in the video (with sound) to mp4 video with ffmpeg to least possible size?

I've an .avi video (divx) that's at 25fps and it has mp3 audio at 64kbit/s. This video has just one image throughout the entire video.

I'm trying to convert this video to mp4 but to make it as small as possible (as there is just 1 frame really!)

I'm currently trying this:

ffmpeg -i video.avi -vcodec libx264 -acodec aac \
-ar 32000 -ab 64k -ac 2 -strict -2 -y video.mp4

But this makes an mp4 video that's similar size to .avi.

Next I tried changing frame-rate to 1fps:

ffmpeg -i video.avi -vcodec libx264 -acodec aac \
-ar 32000 -ab 64k -ac 2 -strict -2 -y -r 1 video.mp4

This made the video file much smaller (10x smaller) but it has an issue that the key-frame doesn't appear at 1st frame of the video. So the only frame in the video appears like 8 or 10 seconds in the video (!).

It looks like the problem here is that ffmpeg keeps dropping frames from video.avi and it doesn't write them to video.mp4 as keyframes. When it does write a keyframe it's late in the video.

It tried using -force_key_frames argument but that didn't help either. I did -force_key_frames 0 and -force_key_frames 1.

Does anyone know how I could create a really small mp4 video with just 1 static frame?


Source: (StackOverflow)

How to see what command-line options handbrake sends to mencoder

I want to see what command-line options handbrake is sending to mencoder. I looked at the Activity Window and it shows a lot of stuff but not what I'm looking for. How can I find it?


Source: (StackOverflow)

Batch Convert .mkv to .mp4

I want to batch convert all .mkv files in a folder into .mp4 with VLC.

It should use the original video-/audio stream and if possible the .ass subtitle of the .mkv. It's not really a conversion, it's more like changing the container – my player can't read the MKV videos.

If I do this conversion by hand (manually) it works, but I have a lot of MKV files to convert, so it would take a lot of time.

I have searched the internet for a batch file to do this and I found a few. I tried to modify them to my wish, but all attempts I tried just created a .mp4 file that doesn't contain the audio stream and the video stream also cannot be rendered by all my media players on the PC.

So could someone tell me how the batch has to look like, so it works with the original video and audio stream (and maybe .ass subtitles)?


Source: (StackOverflow)

ffmpeg - How to copy|extract encoding settings from existing media file?

I wished to be able do this multiple times now so I ask.

If I have an existing video or audio file, ffmpeg, mplayer and other media players can detect at least some of it's "propreties" like container, codec and bitrate used, probably various quality and encoding specific settings, etc.

How can I extract these settings from an existing file in order to use them (directly) for encoding with ffmpeg?

For example, I got an mkv video encoded with x264 with some settings, and another uncompressed avi file. I would like to "copy" the encoding settings used in for x264 mkv file to transcode the avi with the same settings.

Note: I'm looking for a way that should include no human work with "translating" the settings from a decoder to the encoder. It is okay if I need to extract the settings first and save it somewhere but I would like to be able to simply feed the read options to a command line or preset|configuration file for ffmpeg.


Source: (StackOverflow)

How does bitrate differ for the same resolution and framerate?

Reading about video quality I found that it depends of resolution, frames per second and bitrate, which decides the size of the video.

My question is how the bitrate is calculated and how it can differ.

Let's say a video has a 360x240 resolution. It takes 86400 pixels per frame. The frame rate is 30 Hz. So the video takes 86400 × 30 = 2592000 pixels per second.

So let's say 1 pixel is 3 Bytes (24 Bits) of data: we have 2592000 × 24 bits per second video (62208000 Bits), that is 62208 kBits (This does not sound right, maybe some problem in my calculation).

But how can it differ and how does it make difference in quality?


Source: (StackOverflow)

What is the CORRECT way to fix keyframes in FFMPEG for DASH?

When conditioning a stream for DASH playback, random access points must be at the exact same source stream time in all streams. The usual way to do this is to force a fixed frame rate and fixed GOP length (i.e. a keyframe every N frames).

In FFMPEG, fixed frame rate is easy (-r NUMBER).

But for fixed keyframe locations (GOP length), there are three methods...which one is "correct"? The FFMPEG documentation is frustratingly vague on this.

Method 1: messing with libx264's arguments

-c:v libx264 -x264opts keyint=GOPSIZE:min-keyint=GOPSIZE:scenecut=-1

There seems to be some debate if scenecut should be turned off or not, as it is unclear if the keyframe "counter" is restarted when a scene cut happens.

Method 2: setting a fixed GOP size:

-g GOP_LEN_IN_FRAMES

This is unfortunately only documented in passing in the FFMPEG documentation, and thus the effect of this argument is very unclear.

Method 3: insert a keyframe every N seconds (MAYBE):

-force_key_frames expr:gte(t,n_forced*GOP_LEN_IN_SECONDS)

This is explicitly documented. But it is still not immediately clear if the "time counter" restarts after every key frame. For instance, in an expected 5-second GOP, if there is a scenecut keyframe injected 3 seconds in by libx264, would the next keyframe be 5 seconds later or 2 seconds later?

In fact, the FFMPEG documentation differentiates between this and the -g option, but it doesn't really say how these two options above are the least bit different (obviously, -g is going to require a fixed frame rate).

WHICH IS RIGHT?

It would seem that the -force_key_frames would be superior, as it would not require a fixed frame rate. However, this requires that

  • it conforms to GOP specifications in H.264 (if any)
  • it GUARANTEES that there would be a keyframe in fixed cadence, irrespective of libx264 scenecut keyframes.

It would also seem that -g could not work without forcing a fixed frame rate (-r), as there is no guarantee that multiple runs of ffmpeg with different codec arguments would provide the same instantaneous frame rate in each resolution. Fixed frame rates may reduce compression performance (IMPORTANT in a DASH scenario!).

Finally, the keyint method just seems like a hack. I hope against hope that this isn't the correct answer.

References:

An example using the -force_key_frames method

An example using the keyint method

FFMPEG advanced video options section


Source: (StackOverflow)