2

For example say I use the command:

ffmpeg -i input.mkv -c copy output.avi

(In my case I need to add -bsf:v h264_mp4toannexb)

Well I can also just copy and rename the file from input.mkv to output.avi manually in windows. When I callup their info in ffmpeg...it's almost same. With the exception that ffmpeg also does slightly different video durations...which is kinda worrisome but from the listed information online it doesn't affect anything other than if you potentially gutted the video into 2 sections and were trying to recombine it using the old times.

But I mean between the two, windows is providing a more accurate and possibly more easy method...no?

Are there just exceptions and for some formats windows won't let you change the containers with filename changes by default?

Or is this just a generic function ffmpeg does in order to facilitate its more advanced commands?

Just curious if I'm missing something.

2

No, a Windows (or Mac or Linux) file rename will not change the container. They are inherently different file formats. They store data differently. They reference the audio and video tracks differently. Re-wrapping from one container to another can actually be a fairly complex operation depending on how the two formats store essence tracks. It may seem like ffmpeg isn't doing any "real work" compared to a transcode, but that is because the video doesn't have to be decoded in a re-wrap. The compressed bits only need to be re-written in a new order with some new metadata.

Think about it this way: just renaming a Word document from .docx to .xlsx doesn't make it an Excel workbook. Your story doesn't get turned into a spreadsheet just because you changed the extension. You need to a use a program to convert every tab into a cell.

The only exception where a simple rename works is where the extensions are synonyms of each other. For example, if you have a program that is expecting all QuickTime wrapped files to be .qt, but you have a .mov, you can rename the file to get it to work. But that is only because they are two different extensions that identify the same container format.

| improve this answer | |
  • It's pretending to change the container and it's just tricking ffmpeg and everything into believing its an avi container now? Again, is there a way to confirm this? I believe I understand your post, windows lets me change the extension of a .txt file to a .png and it'll read as a png and all that in ffmpeg as well. But in the case of the avi.....it plays fine...reads as an avi....what is the real difference in that case? I'm just tricking everything into thinking an mkv is an avi? Couldn't that be useful for other purposes? – kite Dec 19 '18 at 7:04
  • I just find that kinda disturbing if there's no way to confirm for real, as doesn't that mean you can trick anything into believing something is something else? A .exe can be hidden as an image file.....etc? – kite Dec 19 '18 at 7:06
  • Most programs will actually verify the format of the file using more than just the extension. – Michael Liebman Dec 19 '18 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.