I write a program which receives several video files and converts them into .mp4 (H.264), .ogv, and .webm (using ffmpeg). The conversion happens on my server, to which the files are uploaded without changes (conversion happens on the server).
What if I receive a file in several formats (that is the same base filename with different extensions)?
1. Should in this case if I receive a file in .mp4 (H.264), .ogg/ogv or .webm, just upload the file and not convert it? (I would require to upload the file in several formats). Is it worth to upload more than one file to my server which has ffmpeg installed there?
2. When converting from one format to another, if I receive the file in several formats, which file extensions should I prefer? (please make list in order of decreasing priority of formats)
+ Reply to Thread
Results 1 to 2 of 2
Please be aware that media files consist of two main parts: The container and the content. Filename extensions are never a guarantee for either, at most a hint what container (and partially what content) should be expectable.
So would the extension .mp4 make you expect an MP4 container, which may contain AVC (H.264) or a different video format (e.g. HEVC or MPEG-4 Part 2 a.k.a. DivX/Xvid), and AAC or a different audio format (e.g. MP3 or AC3).
Similar to .webm, making you expect a WebM container (a subset of MKV), probably containing Google/On2 VP(8/9/10) video, and Vorbis or Opus audio.
Both MP4 and WebM are quite common, quite standardized, yet with a small range of variants. The OGM container (.ogm/.ogv) should be considered "obsolete", in comparison.
In general, you should avoid conversions whenever possible, because every conversion using a lossy algorithm will decrease the quality. On the other hand, you will never know if the upload is suitable for the purpose of e.g. streaming over the internet, often videos are optimized rather for efficient encoding and playback from fast local media; and you will never know if anyone found a way to forge media which may exploit security holes... Video web portals recode every uploaded video on purpose, reducing the quality inevitably.