Feature Request: Virtual Extension Parameter
|Reported by:||Thomas Johnson||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
This is more like feature request rather than an issue, but you may consider it an issue if you want.
A huge amount of users recently asked me similar questions, and because there is no official solution, I'm filing this issue here, and I hope it will be fixed (implemented) soon.
I'm writting an UI application which asks user to provide input file path and input format (separatelly) and output file path and output format (separatelly). So, for example, user may enter:
Input Path: "./1.exe"
Input Format: "mkv"
Output Path: "./1.bmp"
Output Format: "jpg"
And then my application should generate command line parameters for ffmpeg such that ffmpeg reads file "1.exe" like it is in "mkv" format, then converts it to "jpg" format and then save it to "1.bmp", but in "jpg" format. I though that it will not require a lot of work, but then i realized that it is not easy at all.
The main problem is because ffmpeg detects input/output format primarily by file extension. However, if the extension differs from the format, the things get very complicated. The main reason for it is because there is no official list (pattern) that describes which command line parameters need to be used in order to encode in specific extension (while the real extension may be different).
For most file formats, I've noticed that "-c:v ext -image2" will encode it in extension "ext" (assuming it is supported extension) no matter what real output file extenion is. However, there a lot of exceptions. For example, "jpg" requires "-c:v singlejpeg" instead of "-c:v jpg".
I also noticed that for video formats one should pass "-f ext" in order to encode it to specific extension "ext". However, there are also a lot of exceptions. For example, "mkv" file format requires "-f matroska" instead of "-f mkv".
This is the feature request I'm filing: please create and publish official list which will provide command line parameters for each extension. It may be a table with two collumns: first collumn containing extensions and the second column containing command line parameters required in order to ffmpeg encode file in that specific extension (no matter what real extension is).
Or, even better, implement a specific parameter (you may call it "virtual extension") which will allow users to override real extension (for input or output file) which will be used internally by ffmpeg while muxing/demuxing, and then save it to real file path.