Opened 3 years ago

Closed 2 years ago

Last modified 11 months ago

#9299 closed defect (needs_more_info)

ffmpeg xfade eating too much memory(killed by kernel)

Reported by: Richard W Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: xfade
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Richard W)

I am using ffmpeg to concatenate some clips with transitions, but it's using up to 15G memory in my machine and it gets killed by the kernel. there are 15 clips (1080P) and total time around 2.5 minutes.

The exact command I am using is:

/data/ffmpeg-git-20210611-amd64-static/ffmpeg -i cut_result0.mp4 -i cut_result1.mp4 -i cut_result2.mp4 -i cut_result3.mp4 -i cut_result4.mp4 -i cut_result5.mp4 -i cut_result6.mp4 -i cut_result7.mp4 -i cut_result8.mp4 -i cut_result9.mp4 -i cut_result10.mp4 -i cut_result11.mp4 -i cut_result12.mp4 -i cut_result13.mp4 -i cut_result14.mp4 -filter_complex "[0:v][1:v]xfade=transition=fadeblack:duration=1.000:offset=8.960[v01];[v01][2:v]xfade=transition=fadeblack:duration=1.000:offset=16.120[v02];[v02][3:v]xfade=transition=fadeblack:duration=1.000:offset=25.760[v03];[v03][4:v]xfade=transition=fadeblack:duration=1.000:offset=34.000[v04];[v04][5:v]xfade=transition=fadeblack:duration=1.000:offset=46.800[v05];[v05][6:v]xfade=transition=fadeblack:duration=1.000:offset=62.440[v06];[v06][7:v]xfade=transition=fadeblack:duration=1.000:offset=70.840[v07];[v07][8:v]xfade=transition=fadeblack:duration=1.000:offset=80.440[v08];[v08][9:v]xfade=transition=fadeblack:duration=1.000:offset=85.360[v09];[v09][10:v]xfade=transition=fadeblack:duration=1.000:offset=114.080[v10];[v10][11:v]xfade=transition=fadeblack:duration=1.000:offset=122.080[v11];[v11][12:v]xfade=transition=fadeblack:duration=1.000:offset=127.400[v12];[v12][13:v]xfade=transition=fadeblack:duration=1.000:offset=132.600[v13];[v13][14:v]xfade=transition=fadeblack:duration=1.000:offset=137.680,format=yuv420p[video];[0:a][1:a]acrossfade=d=1.000:c1=tri:c2=tri[a01];[a01][2:a]acrossfade=d=1.000:c1=tri:c2=tri[a02];[a02][3:a]acrossfade=d=1.000:c1=tri:c2=tri[a03];[a03][4:a]acrossfade=d=1.000:c1=tri:c2=tri[a04];[a04][5:a]acrossfade=d=1.000:c1=tri:c2=tri[a05];[a05][6:a]acrossfade=d=1.000:c1=tri:c2=tri[a06];[a06][7:a]acrossfade=d=1.000:c1=tri:c2=tri[a07];[a07][8:a]acrossfade=d=1.000:c1=tri:c2=tri[a08];[a08][9:a]acrossfade=d=1.000:c1=tri:c2=tri[a09];[a09][10:a]acrossfade=d=1.000:c1=tri:c2=tri[a10];[a10][11:a]acrossfade=d=1.000:c1=tri:c2=tri[a11];[a11][12:a]acrossfade=d=1.000:c1=tri:c2=tri[a12];[a12][13:a]acrossfade=d=1.000:c1=tri:c2=tri[a13];[a13][14:a]acrossfade=d=1.000:c1=tri:c2=tri[audio]" -map [video] -map [audio] -movflags +faststart my_output.mp4

The full log at https://pastebin.com/AszkJh6E
Please note the full log is a successful one which I ran on a more powerful machine with 100G+ memory.
The original samples are uploaded to office one drive: https://dutaotbsteduau-my.sharepoint.com/:f:/g/personal/i_edu365_site/EoeBxKbg0xBIv2-Ky54dxdEBgw8wUY6ZgEsp2dCNk93LzA?e=tbHyXe

Change History (6)

comment:1 by Richard W, 3 years ago

Description: modified (diff)

comment:2 by Carl Eugen Hoyos, 3 years ago

Keywords: memory killed removed

Why do you think that there is a bug that can be fixed in FFmpeg?

in reply to:  2 comment:3 by Richard W, 3 years ago

Replying to Carl Eugen Hoyos:

Why do you think that there is a bug that can be fixed in FFmpeg?

I am not sure if it's a bug, just maybe. When I use only xfades or acrossfades in my command, the memory usage looks good, but with both it keeps consuming memory.

comment:4 by Elon Musk, 3 years ago

That can usually happen when A/V sync drifts so much that it need to keep everything in memory. On more powerful machine you can use single graphmonitor filter to show you filter stats during filtering.
Feel free to report here if it reports red numbers (cache filling too much).

comment:5 by Elon Musk, 2 years ago

Resolution: needs_more_info
Status: newclosed

File are gone.

comment:6 by Elon Musk, 11 months ago

With latest git version, memory usage of xfade/acrossfade should be significantly lower.

Note: See TracTickets for help on using tickets.