Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Support picture-based subtitles? Crash with command "-i 1.mp4 -vf subtitles=1.srt 2.mp4" #19

Closed
FengDeng opened this issue Sep 6, 2018 · 12 comments
Assignees
Labels
bug Something isn't working fixed

Comments

@FengDeng
Copy link

FengDeng commented Sep 6, 2018

No description provided.

@tanersener tanersener self-assigned this Sep 6, 2018
@tanersener
Copy link
Owner

I guess picture-based subtitles were not tested. Can you provide a sample .srt file so I can test it?

@FengDeng
Copy link
Author

FengDeng commented Sep 6, 2018

@tanersener
Copy link
Owner

Hi,
I made some tests with your project. Burning picture-based subtitles worked on IOS simulator but crashed on a real device with arm64 architecture. Is this the issue you encountered?

@FengDeng
Copy link
Author

FengDeng commented Sep 6, 2018

Yes,It crashed on real devices.

@FengDeng
Copy link
Author

FengDeng commented Sep 6, 2018

default

By the way,memory leaks...

@shoyu666
Copy link

shoyu666 commented Sep 6, 2018

add subtitle by "-vf "
mp4 file size 22M
android memory Increased to 100M+

@tanersener
Copy link
Owner

By the way,memory leaks...

I see them too, unfortunately they come from ffmpeg libraries, no quick fix atm. Tried many things about them but modifying ffmpeg source is needed. Good thing is most of them are small in size, around a few KB. But some leaks in external libraries x265 and libvidstab are huge and wastes MBs. Will monitor them in new releases.

Your issue with subtitles is a bug. I'm working on it but can not give a time frame about the fix.

@tanersener tanersener added the bug Something isn't working label Sep 6, 2018
@tanersener
Copy link
Owner

Hi, a patch is released about this issue; v2.1.1 is published in cocoapods.

@FengDeng
Copy link
Author

Thanks your great project.I changed my way of implementation.Not use ffmpeg.
And I test 2.1.1 with my demo,picture-based subtitle is not work.

@tanersener
Copy link
Owner

OK mate; it's your decision to use FFmpeg or not. I just want to make sure everything is working properly.

There is an error on your project (https://github.com/FengDeng/SOSubtitle/tree/master/SOSubtitle). By applying the following two steps it is possible to successfully burn picture-based subtitles.

1. Add 方正大黑_GBK.ttf font to your project.

1

2. Update these two statements inside AppDelegate.swift

if let resourcePath = Bundle.main.resourcePath {
    MobileFFmpegConfig.setFontDirectory("\(resourcePath)", with: nil)
}

let r = MobileFFmpeg.execute("-i \(input) -vf subtitles=\(ass):force_style='FontName=方正大黑_GBK' \(output)")

Generated video will include subtitles.

2

@FengDeng
Copy link
Author

@tanersener
cool.Thanks very much.Sorry to trouble you.

@tanersener
Copy link
Owner

no trouble mate, anytime

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

3 participants