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

[IOS] Message from debugger: Terminated due to memory issue #47

Closed
chaocharleswang opened this issue Dec 5, 2018 · 15 comments
Closed
Assignees
Labels
bug Something isn't working fixed

Comments

@chaocharleswang
Copy link

Description
Message from debugger: Terminated due to memory issue

let ffmpegCommand = "-i input_path -c copy -f mp4 output_path"

// EXECUTE
let result: Int = Int(MobileFFmpeg.execute(ffmpegCommand, delimiter: " "))

if result == RETURN_CODE_SUCCESS
{
print("FFmpeg Success")
}

Logs
2018-12-04 20:29:39.961 TestURLParser[44089:3273462] INFO: libavutil 56. 19.101 / 56. 19.101
2018-12-04 20:29:39.961 TestURLParser[44089:3273462] INFO: libavcodec 58. 33.102 / 58. 33.102
2018-12-04 20:29:39.961 TestURLParser[44089:3273462] INFO: libavformat 58. 19.102 / 58. 19.102
2018-12-04 20:29:39.961 TestURLParser[44089:3273462] INFO: libavdevice 58. 4.106 / 58. 4.106
2018-12-04 20:29:39.961 TestURLParser[44089:3273462] INFO: libavfilter 7. 37.100 / 7. 37.100
2018-12-04 20:29:39.961 TestURLParser[44089:3273462] INFO: libswscale 5. 2.100 / 5. 2.100
2018-12-04 20:29:39.961 TestURLParser[44089:3273462] INFO: libswresample 3. 2.100 / 3. 2.100
2018-12-04 20:29:39.992 TestURLParser[44089:3273462] INFO: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:///var/mobile/Containers/Data/Application/5A35650D-9FF4-4720-8BB9-F1648526C6C1/Documents/dash.m4a':
2018-12-04 20:29:39.992 TestURLParser[44089:3273462] INFO: Metadata:
2018-12-04 20:29:39.992 TestURLParser[44089:3273462] INFO: major_brand :
2018-12-04 20:29:39.992 TestURLParser[44089:3273462] INFO: dash
2018-12-04 20:29:39.992 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: minor_version :
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: 0
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: compatible_brands:
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: iso6mp41
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: creation_time :
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: 2018-12-03T11:10:23.000000Z
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: Duration:
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: 01:26:51.70
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: , start:
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: 0.000000
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: , bitrate:
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: 129 kb/s
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.993 TestURLParser[44089:3273462] INFO: Stream #0:0
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO: (eng)
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO: : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 0 kb/s
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO: (default)
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO: Metadata:
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO: creation_time :
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO: 2018-12-03T11:10:23.000000Z
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO: handler_name :
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO: ISO Media file produced by Google Inc. Created on: 12/03/2018.
2018-12-04 20:29:39.994 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: Output #0, mp4, to 'file:///var/mobile/Containers/Data/Application/5A35650D-9FF4-4720-8BB9-F1648526C6C1/Documents/mpeg-4.m4a':
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: Metadata:
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: major_brand :
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: dash
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: minor_version :
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: 0
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: compatible_brands:
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: iso6mp41
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: encoder :
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: Lavf58.19.102
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: Stream #0:0
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: (eng)
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 0 kb/s
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: (default)
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: Metadata:
2018-12-04 20:29:39.997 TestURLParser[44089:3273462] INFO: creation_time :
2018-12-04 20:29:39.998 TestURLParser[44089:3273462] INFO: 2018-12-03T11:10:23.000000Z
2018-12-04 20:29:39.998 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.998 TestURLParser[44089:3273462] INFO: handler_name :
2018-12-04 20:29:39.998 TestURLParser[44089:3273462] INFO: ISO Media file produced by Google Inc. Created on: 12/03/2018.
2018-12-04 20:29:39.998 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.998 TestURLParser[44089:3273462] INFO: Stream mapping:
2018-12-04 20:29:39.998 TestURLParser[44089:3273462] INFO: Stream #0:0 -> #0:0
2018-12-04 20:29:39.998 TestURLParser[44089:3273462] INFO: (copy)
2018-12-04 20:29:39.998 TestURLParser[44089:3273462] INFO:
2018-12-04 20:29:39.998 TestURLParser[44089:3273462] INFO: Press [q] to stop, [?] for help
2018-12-04 20:29:40.499 TestURLParser[44089:3273462] INFO: size= 4352kB time=00:04:39.59 bitrate= 127.5kbits/s speed= 557x

2018-12-04 20:29:40.999 TestURLParser[44089:3273462] INFO: size= 8704kB time=00:09:21.73 bitrate= 126.9kbits/s speed= 561x

2018-12-04 20:29:41.499 TestURLParser[44089:3273462] INFO: size= 13056kB time=00:13:58.86 bitrate= 127.5kbits/s speed= 559x

2018-12-04 20:29:42.006 TestURLParser[44089:3273462] INFO: size= 17408kB time=00:18:38.29 bitrate= 127.5kbits/s speed= 557x

2018-12-04 20:29:42.506 TestURLParser[44089:3273462] INFO: size= 21504kB time=00:23:03.58 bitrate= 127.3kbits/s speed= 551x

2018-12-04 20:29:43.011 TestURLParser[44089:3273462] INFO: size= 25856kB time=00:27:37.46 bitrate= 127.8kbits/s speed= 550x

2018-12-04 20:29:43.511 TestURLParser[44089:3273462] INFO: size= 29952kB time=00:32:09.25 bitrate= 127.2kbits/s speed= 549x

2018-12-04 20:29:44.011 TestURLParser[44089:3273462] INFO: size= 34304kB time=00:36:45.91 bitrate= 127.4kbits/s speed= 550x

2018-12-04 20:29:44.514 TestURLParser[44089:3273462] INFO: size= 38656kB time=00:41:16.19 bitrate= 127.9kbits/s speed= 548x

2018-12-04 20:29:45.014 TestURLParser[44089:3273462] INFO: size= 43008kB time=00:45:54.58 bitrate= 127.9kbits/s speed= 549x

2018-12-04 20:29:45.515 TestURLParser[44089:3273462] INFO: size= 47104kB time=00:50:15.36 bitrate= 128.0kbits/s speed= 546x

2018-12-04 20:29:46.015 TestURLParser[44089:3273462] INFO: size= 51200kB time=00:54:48.54 bitrate= 127.5kbits/s speed= 546x

2018-12-04 20:29:46.515 TestURLParser[44089:3273462] INFO: size= 55552kB time=00:59:20.89 bitrate= 127.8kbits/s speed= 546x

2018-12-04 20:29:47.015 TestURLParser[44089:3273462] INFO: size= 59648kB time=01:03:50.22 bitrate= 127.6kbits/s speed= 546x

2018-12-04 20:29:47.523 TestURLParser[44089:3273462] INFO: size= 63744kB time=01:08:13.70 bitrate= 127.6kbits/s speed= 544x

2018-12-04 20:29:48.024 TestURLParser[44089:3273462] INFO: size= 68096kB time=01:12:43.28 bitrate= 127.8kbits/s speed= 544x

2018-12-04 20:29:48.528 TestURLParser[44089:3273462] INFO: size= 72192kB time=01:17:12.86 bitrate= 127.7kbits/s speed= 543x

Message from debugger: Terminated due to memory issue

Environment

  • Xcode 10.1
@tanersener tanersener self-assigned this Dec 5, 2018
@tanersener
Copy link
Owner

tanersener commented Dec 5, 2018

Most of the time Terminated due to memory issue error is received when a complex command is executed. But I think it is not the case for your command.

According to the last line of your log, output file is 72192kB in size and 1 hour 17 minutes in length. What is the length of your dash.m4a input file, can you share it if possible?

@chaocharleswang
Copy link
Author

General
Complete name : /Users/charleswang/Documents/dash.m4a
MD5 Hash : 8e1d2b98abae0aba38c5f74e374929d5
SHA1 Hash : af56463c47742cb6ef5891f6475c2cb552da4f42
Created : Wed Dec 5 07:59:03 2018
Modified : Mon Dec 3 06:20:54 2018
Owner : charleswang
Owner Real Name : Charles Wang
Read and Write : rw-r--r--
Blocksize for filesystem : 4096
Number of blocks allocated : 164856
Number of hard links : 1
Inode : 8650639697
Format : dash
Codec ID : dash
File size : 80.4 MiB
Duration : 1h 26mn
Overall bit rate : 129 Kbps
Encoded date : UTC 2018-12-03 11:10:23
Tagged date : UTC 2018-12-03 11:10:23

Audio
ID : 1
Format : AAC
Format/Info : Advanced Audio Codec
Format version : Version 4
Format profile : LC
Format settings, SBR : No
Codec ID : 40
Duration : 1h 26mn
Bit rate mode : Constant
Channel(s) : 2 channels
Channel positions : L R
Sampling rate : 44.1 KHz
Resolution : 16 bits
Title : ISO Media file produced by Google Inc. Created on: 12/03/2018.
Language : English
Encoded date : UTC 2018-12-03 11:10:23
Tagged date : UTC 2018-12-03 11:10:23

@chaocharleswang
Copy link
Author

file size: 84.3MB

@chaocharleswang
Copy link
Author

I just want ffmpeg to change the container from dash to mpeg-4.

@chaocharleswang
Copy link
Author

I ran the same command on my mac. It works well.

ffmpeg -i dash.m4a -c copy -f mp4 mpeg-4.m4a
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'dash.m4a':
Metadata:
major_brand : dash
minor_version : 0
compatible_brands: iso6mp41
creation_time : 2018-12-03T11:10:23.000000Z
Duration: 01:26:51.70, start: 0.000000, bitrate: 129 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 0 kb/s (default)
Metadata:
creation_time : 2018-12-03T11:10:23.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 12/03/2018.
Output #0, mp4, to 'mpeg-4.m4a':
Metadata:
major_brand : dash
minor_version : 0
compatible_brands: iso6mp41
encoder : Lavf58.20.100
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 0 kb/s (default)
Metadata:
creation_time : 2018-12-03T11:10:23.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 12/03/2018.
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size= 82311kB time=01:26:51.67 bitrate= 129.4kbits/s speed=6.2e+03x
video:0kB audio:81433kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.078430%

@chaocharleswang
Copy link
Author

You can get dash.m4a with the following link:
https://www.dropbox.com/s/z4egiq3mwqkktp1/dash.m4a?dl=0

@tanersener
Copy link
Owner

You can get dash.m4a with the following link:
https://www.dropbox.com/s/z4egiq3mwqkktp1/dash.m4a?dl=0

Thanks, I'm monitoring your command in my test env.

Meantime, I want to remind that m4a is an audio only mpeg 4 file extension: https://en.wikipedia.org/wiki/MPEG-4_Part_14#.MP4_versus_.M4A . So your command only copies one .m4a file to another another .m4a file. Formats of both files are the same.

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'dash.m4a':
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 0 kb/s (default)
Output #0, mp4, to 'mpeg-4.m4a':
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 0 kb/s (default)

@chaocharleswang
Copy link
Author

chaocharleswang commented Dec 5, 2018 via email

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

However, their mp4 containers are different. One is dash

ffmpeg prints the following media information for dash.m4a. One of the metadata keys has a value of dash but other than that I don't see anything about dash. Anyway, if you say it is dash then it is dash, I have no objection since it is not our issue here.

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'dash.m4a':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6mp41
    creation_time   : 2018-12-03T11:10:23.000000Z
  Duration: 01:26:51.70, start: 0.000000, bitrate: 129 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 0 kb/s (default)
    Metadata:
      creation_time   : 2018-12-03T11:10:23.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 12/03/2018.
Stream mapping:
  Stream #0:0 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6mp41
    encoder         : Lavf58.20.100
    Stream #0:0(eng): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
    Metadata:
      creation_time   : 2018-12-03T11:10:23.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 12/03/2018.
      encoder         : Lavc58.35.100 pcm_s16le
size=N/A time=01:26:51.69 bitrate=N/A speed=1.02e+03x
video:0kB audio:897796kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

@tanersener
Copy link
Owner

Unfortunately I think there might be a bug here.

Can you disable redirection with the following command at the beginning of your application and try again? It will disable logs, so your output will be empty but other features will work.

[MobileFFmpegConfig disableRedirection];

@chaocharleswang
Copy link
Author

chaocharleswang commented Dec 5, 2018 via email

@tanersener
Copy link
Owner

I forgot you are using Swift. Can you add MobileFFmpegConfig.disableRedirection() at the beginning of your application and try again?

@chaocharleswang
Copy link
Author

chaocharleswang commented Dec 6, 2018

It works now! Fantastic 👍
Keep updating.

Question: why do I need use the function when using Swift? Thanks!

@tanersener
Copy link
Owner

Question: why do I need use the function when using Swift? Thanks!

No, it is not about Swift. First I had recommended using [MobileFFmpegConfig disableRedirection]; which is in Objective C; then I realized you were using Swift, I just wanted to emphasize that.

In fact MobileFFmpegConfig.disableRedirection() line is a workaround. The bug is still there. I'll work on the bug and keep this thread updated. Thanks for reporting this issue.

@tanersener tanersener changed the title Message from debugger: Terminated due to memory issue [IOS] Message from debugger: Terminated due to memory issue Dec 6, 2018
@tanersener
Copy link
Owner

@chaocharleswang thanks for reporting this issue. It is fixed in v3.1 release.

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

2 participants