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

[iOS] How to output Chinese file name? #360

Closed
cimonk opened this issue Mar 6, 2020 · 10 comments
Closed

[iOS] How to output Chinese file name? #360

cimonk opened this issue Mar 6, 2020 · 10 comments
Assignees
Labels
bug Something isn't working fixed

Comments

@cimonk
Copy link

cimonk commented Mar 6, 2020

I use this command to do merge video file:
-y -f concat -safe -1 -i "/Users/XXX/Library/Developer/CoreSimulator/Devices/9B0CC62F-D424-42D2-93E9-7D9FF672B29E/data/Containers/Data/Application/F07EE09F-A82D-4F3C-AC79-819005BDBD44/tmp/【K萌君】教你做Windows+Ubuntu双系统.txt" -c copy -bsf:a aac_adtstoasc /Users/XXX/Library/Developer/CoreSimulator/Devices/9B0CC62F-D424-42D2-93E9-7D9FF672B29E/data/Containers/Data/Application/F07EE09F-A82D-4F3C-AC79-819005BDBD44/Documents/Downloads/20200306_141905981.mp4

But ffmpeg output the error log:
Command execution failed with rc=1 and output=ffmpeg version git-2020-01-25-fd11dd500 Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk --prefix=/Users/taner/Projects/mobile-ffmpeg/prebuilt/ios-x86_64-apple-darwin/ffmpeg --enable-version3 --arch=x86_64 --cpu=x86_64 --target-os=darwin --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang++ --as='clang -arch x86_64 -target x86_64-ios-darwin -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DMOBILE_FFMPEG_X86_64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -DIOS -DMOBILE_FFMPEG_BUILD_DATE=20200125 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk -O2 -mios-simulator-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/usr/include' --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --disable-neon --enable-cross-compile --enable-pic --enable-asm --enable-inline-asm --enable-optimizations --enable-swscale --enable-static --disable-shared --enable-small --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --disable-openssl --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libshine --enable-libspeex --enable-libwavpack --enable-libkvazaar --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libaom --enable-libtwolame --disable-sdl2 --enable-zlib --enable-audiotoolbox --enable-coreimage --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv
libavutil 56. 38.100 / 56. 38.100
libavcodec 58. 65.102 / 58. 65.102
libavformat 58. 35.101 / 58. 35.101
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 70.101 / 7. 70.101
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
/Users/XXX/Library/Developer/CoreSimulator/Devices/9B0CC62F-D424-42D2-93E9-7D9FF672B29E/data/Containers/Data/Application/F07EE09F-A82D-4F3C-AC79-819005BDBD44/tmp/�K ��Y`ZWindows+Ubuntu√ÉÀöÔ¨Ç.txt: No such file or directory

The log seems it could not set UTF-8 or unicode argument.

Please help, thanks.

@xwal
Copy link

xwal commented Mar 6, 2020

Me too. I have tried again and again.

@tanersener
Copy link
Owner

How did you find "/Users/XXX/Library/Developer/CoreSimulator/Devices/9B0CC62F-D424-42D2-93E9-7D9FF672B29E/data/Containers/Data/Application/F07EE09F-A82D-4F3C-AC79-819005BDBD44/tmp/【K萌君】教你做Windows+Ubuntu双系统.txt" path?

What happens if you add 【K萌君】教你做Windows+Ubuntu双系统.txt as a resource in your application try to use it as a resource?

@tanersener tanersener self-assigned this Mar 6, 2020
@tanersener tanersener added the question Further information is requested label Mar 6, 2020
@xwal
Copy link

xwal commented Mar 7, 2020

@tanersener I run code with Swift:

MobileFFmpeg.execute("-i \'/var/mobile/Containers/Data/Application/0CE7F4A0-4A4C-45D8-914F-55A01DA9EA9F/Documents/Audios/百花香 - 魏新雨.aac\' -i \'/var/mobile/Containers/Data/Application/0CE7F4A0-4A4C-45D8-914F-55A01DA9EA9F/Documents/Audios/一个人挺好 - 孟颖.aac\' -filter_complex \'[0:0] [1:0]  concat=n=2:v=0:a=1 [a]\' -map [a] /private/var/mobile/Containers/Data/Application/0CE7F4A0-4A4C-45D8-914F-55A01DA9EA9F/tmp/022025FB-278F-4861-8531-24A693D4CCCB.aac")

I get an errror like this in debug area.

ERROR: /var/mobile/Containers/Data/Application/0CE7F4A0-4A4C-45D8-914F-55A01DA9EA9F/Documents/Audios/~±ô - O∞Ë.aac: No such file or directory

How can I solve it? Thanks.

@tanersener
Copy link
Owner

Your issues are not about the library, they are about accessing files with Chinese characters in iOS/tvOS.

I don't have experience with Chinese characters. So I don't have an idea about the fix. Did you try searching for solutions on stackoverflow?

I think you need to try to access those files using a source block like the following one. Did you try that?

NSString* path = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"extension"];
NSLog(@"path is %@",path);

@cimonk
Copy link
Author

cimonk commented Mar 9, 2020

How did you find "/Users/XXX/Library/Developer/CoreSimulator/Devices/9B0CC62F-D424-42D2-93E9-7D9FF672B29E/data/Containers/Data/Application/F07EE09F-A82D-4F3C-AC79-819005BDBD44/tmp/【K萌君】教你做Windows+Ubuntu双系统.txt" path?

What happens if you add 【K萌君】教你做Windows+Ubuntu双系统.txt as a resource in your application try to use it as a resource?

Hi tanersener,

The contents of 【K萌君】教你做Windows+Ubuntu双系统.txt is
file '/Users/XXX/Library/Developer/CoreSimulator/Devices/9B0CC62F-D424-42D2-93E9-7D9FF672B29E/data/Containers/Data/Application/30D65387-BE20-445A-9180-2EDDB7CDBA73/tmp/【K萌君】教你做Windows+Ubuntu双系统[0].flv' file '/Users/XXX/Library/Developer/CoreSimulator/Devices/9B0CC62F-D424-42D2-93E9-7D9FF672B29E/data/Containers/Data/Application/30D65387-BE20-445A-9180-2EDDB7CDBA73/tmp/【K萌君】教你做Windows+Ubuntu双系统[1].flv' file '/Users/XXX/Library/Developer/CoreSimulator/Devices/9B0CC62F-D424-42D2-93E9-7D9FF672B29E/data/Containers/Data/Application/30D65387-BE20-445A-9180-2EDDB7CDBA73/tmp/【K萌君】教你做Windows+Ubuntu双系统[2].flv'

How about iOS Swift use MobileFFmpeg.execute() with Chinese characters?

BTW, my android colleague can use their MobileFFmpeg library to execute with Chinese characters successfully.

@cimonk
Copy link
Author

cimonk commented Mar 9, 2020

Your issues are not about the library, they are about accessing files with Chinese characters in iOS/tvOS.

I don't have experience with Chinese characters. So I don't have an idea about the fix. Did you try searching for solutions on stackoverflow?

I think you need to try to access those files using a source block like the following one. Did you try that?

NSString* path = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"extension"];
NSLog(@"path is %@",path);

I searched that iOS and FFmpeg with Chinese characters, but I didn't find about it.

I also tried it as below, but it does not work too.

NSString* path = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"extension"];
NSLog(@"path is %@",path);

@xwal
Copy link

xwal commented Mar 9, 2020

I found this problem in function + (NSArray*)parseArguments: (NSString*)command , if use unicode char take from Chinese characters, it will take error in this line code char currentChar = [command characterAtIndex:i];.
If I use MobileFFmpeg.execute(withArguments:) function, It will work perfect because commandCharPArray[i + 1] = (char *) [argument UTF8String]; to UTF8 characters.

@tanersener tanersener added bug Something isn't working and removed question Further information is requested labels Mar 9, 2020
@tanersener
Copy link
Owner

tanersener commented Mar 9, 2020

@chaoskyme Thanks for the analysis. Apparently, there was a bug about parsing unicode parameters in MobileFFmpeg.parseArguments function. I fixed that on development branch. It will be included in the next release.

Please use MobileFFmpeg.executeWithArguments method until the fix is released.

@cimonk
Copy link
Author

cimonk commented Mar 10, 2020

Yes!
MobileFFmpeg.executeWithArguments is work!
Thank you @tanersener @chaoskyme !!

@tanersener
Copy link
Owner

Released with v4.3.2

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