Hot answers tagged

31 votes

Repeat/loop Input Video with ffmpeg?

With ffmpeg 2.8.4, the following command creates output.mp4 that is a repeating copy of input.mp4 until the ffmpeg process is stopped: ffmpeg -stream_loop -1 -i input.mp4 -c copy output.mp4 This ...
Thingy's user avatar
  • 456
22 votes
Accepted

How is this .mp4 file 596523 hours long?

There are several things we can note here: The file stops playing after 0:05:30. If you remux the file (mkvtools for example) you do have 5:30 displayed as the length. The original file does in fact ...
v010dya's user avatar
  • 850
17 votes

Merge MP4 with M4A

ffmpeg looks promising. Might be worth a shot. Specifically, the command ffmpeg -i video.mp4 -i audio.m4a -acodec copy -vcodec copy output.mp4 should do the trick.
sgryzko's user avatar
  • 271
16 votes

Repeat/loop Input Video with ffmpeg?

At least on FFmpeg 2.8.x (but oldie should works too) you can use lavfi as input format and complex filter graph using movie and setpts filters as a argument for -i option. Next command doing this ...
Monah Tuk's user avatar
  • 261
13 votes

Removing MP4 encoding information

Use bitstream filter filter_units with ffmpeg 4.0 or newer. ffmpeg -i INPUT -c copy -bsf:v 'filter_units=remove_types=6' OUTPUT P.S. /* NAL unit types */ enum { H264_NAL_SLICE = 1, ...
whmiao's user avatar
  • 131
12 votes
Accepted

Big difference in the video file size after the conversion (.mov to .mp4)

Let me explain you from scratch. MOV, MP4, AVI, MKV etc all these are just containers, It is just kind of wrapper which contains audio, video, text, metadata file together as one file. It does not ...
Unstoppable's user avatar
9 votes
Accepted

ffmpeg concat introduces a/v sync problem

Run ffmpeg -i titlefile.mp4 -vf setdar=16/9 -video_track_timescale 29971 -ac 1 newtitle.mp4 and then run concat with the new title video. Modern containers like MP4 have Presentation TimeStamps, ...
Gyan's user avatar
  • 32.6k
8 votes
Accepted

FFMPEG: Loop video to the length of audio

For video, stream_loop option should be used. ffmpeg -y -stream_loop -1 -i video -i audio.mp3 -fflags +shortest -max_interleave_delta 50000 -c copy output.mp4 You'll have to use a very recent ...
Gyan's user avatar
  • 32.6k
7 votes

How to extract MOOV atom/metadata from MP4 file?

Maybe I'm a bit late, but I'd use bento4 mp4dump, it's really easy to install on mac with brew brew install bento4 mp4dump 1.mp4 [ftyp] size=8+16 major_brand = iso5 minor_version = 200 ...
SkarXa's user avatar
  • 171
7 votes
Accepted

Convert mkv to mp4 (or webM) with the output file viewable in the process

This is possible for MP4, with a caveat. The command below will generate a fragmented MP4, which you can view in a browser while the conversion is taking place. However, only the fragments completely ...
Gyan's user avatar
  • 32.6k
6 votes
Accepted

Removing MP4 encoding information

Regular ffmpeg won't do this. You'll need a combination of two tools to carry this out. #1 Use ffmpeg from direct264, a modded version of an old ffmpeg build with a custom filter to modify H264 ...
Gyan's user avatar
  • 32.6k
6 votes

Corrupt MP4 [recording interrupted]

I recently encountered this exact problem and I was able to repair the file using Untrunc, a program created specifically to solve this problem, as suggested by sparrowt on SuperUser: For this ...
Ajedi32's user avatar
  • 161
6 votes

How do i increase the volume of a video I recorded?

You can use ffmpeg: ffmpeg -i file_with_quiet_sound.mp4 -af volume=150 -vcodec copy newfile.mp4 It will increase volume of your file at 150 times! Don't worry, big values can do funny effects, I ...
bukkojot's user avatar
  • 675
6 votes

Removing Metadata Title in mp4 files

You can try FFMpeg. There are examples showing how to strip all metadata and removing just a single item isn't much different. Try ffmpeg -i in.mp4 -metadata title= -c:v copy -c:a copy out.mp4 This ...
StarGeek's user avatar
  • 181
6 votes

Store video files on USB, SD card, microSD, or external hard drive?

Generally, it’s a bad idea to store data on SD or micro SD cards for any substantial period of time. If you’re a hobbyist, traveling, and plan to transfer to a hard drive when you get home, that’s ...
Jason Conrad's user avatar
  • 4,444
6 votes
Accepted

Lossless convert 3gp video to mp4 using ffmpeg

If the codecs of your input file are already h264 and aac for video and audio, respectively, you can just copy without decoding and encoding again. ffmpeg -i input.3gp -c:v copy -c:a copy output.mp4 ...
kamae's user avatar
  • 196
5 votes
Accepted

Does the MP4 HTML5 compatible video type allow for mono audio?

The Mainconcept or Sony codecs in Vegas are subpar for low-bitrate output such as needed for HTML5 use. Use ffmpeg to generate your HTML5 videos. Yes, mono audio is acceptable for HTML5 use, but once ...
Gyan's user avatar
  • 32.6k
5 votes
Accepted

How to batch covert a folder of mp4 files to avi?

Change the ” to a ". Avoid using TextEdit or other "smart" editors to edit your scripts and shell commands. They will mangle it with fancy quotes and other oddball characters and ruin your commands.
llogan's user avatar
  • 9,904
5 votes

Why when you specify a video bitrate with ffmpeg does the resulting files displayed bit rate differ?

The issue is that you are using -crf with -b:v. ffmpeg is a well built program, so it's just ignoring -b:v and using -crf. If you want to have a specific bitrate, remove the crf command. CRF is "...
user3643's user avatar
  • 2,164
5 votes

What is the colour range of most videos?

Most videos are limited range i.e. luma goes from 16 to 235, and chroma from 16 to 240. Unless expressly set, FFmpeg does not scale the range from one to another. Whatever the source is, that's the ...
Gyan's user avatar
  • 32.6k
5 votes
Accepted

Add multiple mp3 files to an mp4 file with ffmpeg

Use -i /path/to/mp4File -i /path/to/soundmp3File1 -i path/to/soundmp3File2 -map 0 -map 1:a -map 2:a -codec copy -shortest path/to/output/fileWithSounds FFmpeg will automatically select one video and ...
Gyan's user avatar
  • 32.6k
5 votes

Adding audio to picture: video too long even when using -shortest

The most reliable way to ensure a desired length for an output is to specify -t X on the output. But if you need adaptive limiting of the output duration, use ffmpeg -loop 1 -framerate 5 -i 000.png -...
Gyan's user avatar
  • 32.6k
5 votes

How to extract each video scene with FFmpeg

Using the encoder's scenecut to detect scenes is not advisable, since its purpose is efficient GOP splitting taking into account other encoding parameters. It is not a "pure" scene detector. Its ...
Gyan's user avatar
  • 32.6k
5 votes

Store video files on USB, SD card, microSD, or external hard drive?

I strongly advice against microSD cards because they will get lost. They're just too tiny. There are external SSDs which weigh not much, 50g maybe 100g, I think this is not much weight. Of course you ...
Matt's user avatar
  • 1,401
4 votes
Accepted

Adobe Premiere saves m4v instead of mp4

I encountered the same issue when I turned the sound off in the sequence. When I re-enabled audio export, even though I didn't want to or need to, it saved as an mp4 again.
Pamela's user avatar
  • 56
4 votes
Accepted

Is it possible to create a continuously looping video?

I make similar videos for our corporate reception, interstate and overseas offices, events, conferences and presentations etc. The answer is to look outside the video file itself and focus on the ...
alexh's user avatar
  • 703
4 votes
Accepted

Issues looping a stream with FFMpeg

Try with the movie filter instead ffmpeg -loop 1 -i image.jpg -filter_complex \ "movie=video.mov:loop=999,setpts=N/(FRAME_RATE*TB)[1v]; \ [0:v][1v]overlay=x=main_w*0.44:y=main_h*0.33[...
Gyan's user avatar
  • 32.6k
4 votes

Corrupt MP4 [recording interrupted]

Updated: this tool can now recover files from more sources. Try with recover_mp4_to_h264. It's a command line program, and will require a good reference file. Usage as indicated: recover_mp4 ...
Gyan's user avatar
  • 32.6k
4 votes

Convert mp4 to avi while keeping frame rate and quality and being able to play in QuickTime?

An AVI file is just a container and can contain any codec, so if you want to encode to QuickTime and Media player, you need to: ffmpeg -i input.mp4 -c:v libx264 -c:a libmp3lame -b:a 384K output.avi ...
Fabby's user avatar
  • 196
4 votes

MKVToolNix equivalent for .MP4's

I just went through a very similar use-case working with TS files. MoritzLost has the key point but as ffmpeg options can be quite difficult to sort out when you are first getting started, here is a ...
mattpr's user avatar
  • 141

Only top scored, non community-wiki answers of a minimum length are eligible