backgroundremover icon indicating copy to clipboard operation
backgroundremover copied to clipboard

MOV conversion creates an absolutely gargantuan file that's unreadable on Mac

Open boxabirds opened this issue 2 years ago • 13 comments

Hi using the docs I ran this command successfully

backgroundremover -i "/path/to/video.mp4" -tv -o "output.mov"

I had an input file created from an

iPhone, 15MB, 1440x1440, Linear PCM, Timed Metadata, HEVC. 7 seconds, 15MB

The output file when I ran the local copy of this was

1.22GB (that's GIGABYTES, nearly 100x the original size), 1440x1440, MPEG-A AAC, Animation, encoding software Lavf59.27.100

Most crucially, when I open it in QuickTime I get this error "This file contains some media that isn’t compatible with QuickTime Player."

What can I do to get this working so a) it's readable on a Mac and b) it's hopefully approximately the same size 🙂

boxabirds avatar Jan 27 '23 12:01 boxabirds

What version of ffmpeg are you using?

nadermx avatar Feb 02 '23 18:02 nadermx

Also, have you tried opening the file on https://mpv.io/ their player is what I use on ubuntu and it seems to work just fine.

nadermx avatar Feb 02 '23 18:02 nadermx

ffmpeg v 5 1.2.

Even if it's readable, it's 100x the original size. Maybe the file is raw uncompressed frames (so the compression step failed?)

boxabirds avatar Feb 02 '23 18:02 boxabirds

I have no tried with ffmpeg 5 yet, only 4.4 I presume it would still work with 5+ though. Can you try opening the file with the mpv player?

nadermx avatar Feb 02 '23 18:02 nadermx

And I reference specifically this comment when I was building it https://superuser.com/a/1648130/535078

@nadermx Your version of ffmpeg is too old and does not support shortest=1. Use ffmpeg -i video.mp4 -i mask.mp4 -filter_complex "[1][0]scale2ref[mask][main];[main][mask]alphamerge" -c:v qtrle output.mov or upgrade your ffmpeg. What I meant in my last comment is that I tried 4.2.4 without shortest=1, and then viewed output.mov with the player named mpv and it had a transparent background. Best recommendation is to upgrade your ffmpeg. – llogan May 11, 2021 at 21:25

nadermx avatar Feb 02 '23 18:02 nadermx

I think this is expected. It's creating a video that's just a bunch of PNGs stuck together. It might not be playable just because of the sheer bandwidth required. You can try converting it to WebM, that keeps the transparency.

RenaKunisaki avatar Feb 13 '23 16:02 RenaKunisaki

I think it’d be useful to use the original codec to recompress the file. It’s how other tools work I’ve used anyway.

On Mon, 13 Feb 2023 at 16:45, Rena Kunisaki @.***> wrote:

I think this is expected. It's creating a video that's just a bunch of PNGs stuck together. It might not be playable just because of the sheer bandwidth required. You can try converting it to WebM, that keeps the transparency.

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/49#issuecomment-1428271498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABD62PQOEBBJVZJZ4GZOSTWXJQLTANCNFSM6AAAAAAUIUO5MI . You are receiving this because you authored the thread.Message ID: @.***>

boxabirds avatar Feb 13 '23 16:02 boxabirds

Pull requests are accepted

On Mon, Feb 13, 2023 at 10:50 AM Julian Harris @.***> wrote:

I think it’d be useful to use the original codec to recompress the file. It’s how other tools work I’ve used anyway.

On Mon, 13 Feb 2023 at 16:45, Rena Kunisaki @.***> wrote:

I think this is expected. It's creating a video that's just a bunch of PNGs stuck together. It might not be playable just because of the sheer bandwidth required. You can try converting it to WebM, that keeps the transparency.

— Reply to this email directly, view it on GitHub < https://github.com/nadermx/backgroundremover/issues/49#issuecomment-1428271498 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AABD62PQOEBBJVZJZ4GZOSTWXJQLTANCNFSM6AAAAAAUIUO5MI

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/49#issuecomment-1428277816, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXFG3YRW37PGKU5ZKVLWXJQ33ANCNFSM6AAAAAAUIUO5MI . You are receiving this because you were mentioned.Message ID: @.***>

nadermx avatar Feb 13 '23 16:02 nadermx

I tried converting it to VP9 with transparancy but it didn't work. So I used this to convert to MP4 with white background:

ffmpeg -y -f lavfi -i color=lightgrey:s=3840x2160 -i XXX.mov -filter_complex 'overlay=0:0:shortest=1' -c:v libx264 -b:v 2000k -pass 1 -an -f mp4 /dev/null
ffmpeg -f lavfi -i color=lightgrey:s=3840x2160 -i XXX.mov -filter_complex 'overlay=0:0:shortest=1' -c:v libx264 -b:v 2000k -pass 2 -c:a aac -b:a 128k -movflags faststart  output.mp4

Note you have to adjust 3840x2160 to your video dimensions.

hokascha avatar Mar 23 '23 14:03 hokascha

So just to clarify, you want me to find a way to compress the transparent mov?

nadermx avatar May 05 '23 20:05 nadermx

That’d be amazing. I was thinking of doing it at some point but I’m on other projects at the moment so it might be a few months away.

On Fri, 5 May 2023 at 21:06, Johnathan Nader @.***> wrote:

So just to clarify, you want me to find a way to compress the transparent mov?

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/49#issuecomment-1536720739, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABD62PXVUJRSQVW3NK2FTTXEVMVFANCNFSM6AAAAAAUIUO5MI . You are receiving this because you authored the thread.Message ID: @.***>

boxabirds avatar May 05 '23 20:05 boxabirds

Maybe moviepy can do it?

On Fri, 5 May 2023 at 21:22, Julian Harris @.***> wrote:

That’d be amazing. I was thinking of doing it at some point but I’m on other projects at the moment so it might be a few months away.

On Fri, 5 May 2023 at 21:06, Johnathan Nader @.***> wrote:

So just to clarify, you want me to find a way to compress the transparent mov?

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/49#issuecomment-1536720739, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABD62PXVUJRSQVW3NK2FTTXEVMVFANCNFSM6AAAAAAUIUO5MI . You are receiving this because you authored the thread.Message ID: @.***>

boxabirds avatar May 05 '23 20:05 boxabirds

Would be ffmpeg doing it

El vie, 5 de may de 2023 16:23, Julian Harris @.***> escribió:

Maybe moviepy can do it?

On Fri, 5 May 2023 at 21:22, Julian Harris @.***> wrote:

That’d be amazing. I was thinking of doing it at some point but I’m on other projects at the moment so it might be a few months away.

On Fri, 5 May 2023 at 21:06, Johnathan Nader @.***> wrote:

So just to clarify, you want me to find a way to compress the transparent mov?

— Reply to this email directly, view it on GitHub < https://github.com/nadermx/backgroundremover/issues/49#issuecomment-1536720739 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AABD62PXVUJRSQVW3NK2FTTXEVMVFANCNFSM6AAAAAAUIUO5MI

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/49#issuecomment-1536738653, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXEQAG5GP77LL33X54TXEVOTFANCNFSM6AAAAAAUIUO5MI . You are receiving this because you were mentioned.Message ID: @.***>

nadermx avatar May 05 '23 20:05 nadermx