Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOV support and copy mode #9

Closed
mufunyo opened this issue Jun 7, 2018 · 9 comments
Closed

MOV support and copy mode #9

mufunyo opened this issue Jun 7, 2018 · 9 comments
Assignees

Comments

@mufunyo
Copy link

mufunyo commented Jun 7, 2018

Hi,

I hope I'm not too forward with this feature request. Since ffmpegfs currently outputs MP4, I don't think this would be too difficult to pull off, as MP4 and MOV are basically the same format.

A lot of editing software has very extensive QuickTime support but almost no AVI support and certainly no MKV support or other more obscure formats. I'd like to ask for a MOV mode where the filesystem is presented as virtual MOV files, with transcoding only enabled for those formats that can't be directly copied into MOV. For h.264 MP4 and MKV files for instance, transcoding is completely unnecessary as MOV supports wrapping h.264. For all other formats, it would be immensely powerful to use ffmpeg to transcode into ProRes as it is extremely fast and random-access.

Let me know what you think and thanks in advance.

@nschlia
Copy link
Owner

nschlia commented Jun 7, 2018

Good ideas:

Copy of streams is one of the features already on my list. MOV was not planned yet because I thought that MP4 would be enough. If there's a need for MOV target I could add it.

I also did not have the idea of confining the file set to those that do not need transcoding. Nice feature, too, but probably will slow down ffmegfs as it requires scanning every file to find out the codecs. But I suppose I need to try if its too slow or not.

I'll add to the TODO list:

  • MOV target format (ProRes)
  • Confining the file set to those that do not need recode

"Do not need recode" is a little tricky, i.e., when transcoding from a transport stream (TS) this would be no problem if the source is H.264 and AAC, but sometimes it contains MPEG-2 or MP3 or incompatible derivates so at least partial recoding would be required. But I guess I could add an option to allow recode, partial recode or just stream copy.

I am not sure if MOV works at all because the format must be streamable. If MOV supports the necessary extensions it could be done. I can't promise that the format is possible but I'll give it at try.

@mufunyo
Copy link
Author

mufunyo commented Jun 7, 2018

Awesome that you think it's a good idea!

As far as I know MOV is a superset of MP4, so it should support streaming. When you export a MOV file from QuickTime Pro, you get the option to "Optimise for fast start" which I think is Apple-speak for a streamable file. FFmpeg source/docs should provide a decisive answer on the matter.

To clarify what would be most useful:

  • Convert audio-only files to WAV or AIFF
  • Convert video-only and audio-video files to MOV
  • Vcodec copy and acodec copy if supported by MOV
  • Transcode to vcodec prores if video source codec not supported by MOV
  • Transcode to acodec pcm if audio source codec not supported by MOV

As an extra you could have different prores quality levels depending on the source pixformat, for instance ProRes 4:4:4 if the source is RGB and ProRes 4:2:2 if the source is YUV.

@nschlia
Copy link
Owner

nschlia commented Jun 7, 2018

I've added that to the TODO list. I cannot say when I will get to it and how long it will take. I usually need to dive quite deep into the target format to be able to adopt it to fast starting and live streaming.

nschlia added a commit that referenced this issue Jun 11, 2018
@nschlia
Copy link
Owner

nschlia commented Jun 11, 2018

As a first step I added MOV and AIFF as target option. Both seem to work so far, but both need two passes (first copy creates an invalid file, when transcoding has finished a second copy operation gets a correct file).

Needs some efforts still but looks good so far :)

@nschlia
Copy link
Owner

nschlia commented Nov 5, 2018

Work on smart conversion now in progress.

@mufunyo
Copy link
Author

mufunyo commented Nov 5, 2018

Great news! I'm still monitoring this and look forward to testing soon.

@nschlia
Copy link
Owner

nschlia commented Nov 11, 2018

Great news! I'm still monitoring this and look forward to testing soon.

I'll soon have a new version ready for testing. It supports what I call "Smart Transcode", adaptive recoding of video/audio+video sources to MOV (or another video format) and audio only sources to AIFF (or another audio format). I would like to send you a test version before I push it to git. Please email me at nschlia@oblivion-software.de so I can send you a copy.

At the moment, potential video sources, e.g. MP4, will be recoded to MOV, even if they do actually not have a video stream. FLAC, WAV, MP3 will be recoded to AIFF, which is fine in any case.

Reason being that for performance reasons, I cannot scan all files when a directory is listed. Opening and scanning each file would take far too long. So the decision is made by the file extension - e.g. MP3 -> AIFF, MP4/MPG/AVI -> MOV.

The changes are quite extensive, I converted the whole project to C++ and recoded a lot of the procedural stuff to OOP. Most of the C code has been updated to C++ (e.g. std::string instead of char) to avoid memory leaks because of unmatched malloc/free pairs.

This makes an effective breeding ground for nice bugs, so I want to do some testing first before I push it to github.

@nschlia
Copy link
Owner

nschlia commented Nov 12, 2018

Additionally, my testing showed that it is actually necessary to properly detect audio files, e.g mp4 or ogg with audio streams only. This requires some changes in the processing order. I will do that later.

@nschlia
Copy link
Owner

nschlia commented Nov 13, 2018

Split the task into smaller ones, see #16, #17, #18, #19. Closing this one now.

@nschlia nschlia closed this as completed Nov 13, 2018
@nschlia nschlia self-assigned this Mar 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants