Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iPhone MOV files processing problem #74

Closed
secit-pl opened this issue Sep 21, 2020 · 4 comments
Closed

iPhone MOV files processing problem #74

secit-pl opened this issue Sep 21, 2020 · 4 comments

Comments

@secit-pl
Copy link

Describe the bug
While processing MOV files recored from iPhone I got following exception:

ffmpeg failed to execute command '/usr/local/bin/ffmpeg' '-y' '-i' '/Users/user/Downloads/TEMP/IMG_3599.mov' '-c:v' 'libx264' '-c:a' 'aac' '-bf' '1' '-keyint_min' '25' '-g' '250' '-sc_threshold' '40' '-use_timeline' '1' '-use_template' '1' '-init_seg_name' 'video_init_$RepresentationID$.$ext$' '-media_seg_name' 'video_chunk_$RepresentationID$_$Number%05d$.$ext$' '-seg_duration' '10' '-hls_playlist' '0' '-f' 'dash' '-map' '0' '-s:v:0' '256x144' '-b:v:0' '2933k' '-map' '0' '-s:v:1' '426x240' '-b:v:1' '3422k' '-map' '0' '-s:v:2' '640x360' '-b:v:2' '4107k' '-map' '0' '-s:v:3' '854x480' '-b:v:3' '5134k' '-map' '0' '-s:v:4' '1280x720' '-b:v:4' '6845k' '-map' '0' '-s:v:5' '1920x1080' '-b:v:5' '10268k' '-strict' '-2' '-threads' '12' '/Applications/MAMP/htdocs/app/public/videos/IMG_3599/video.mpd':

Error Output:

ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.3 (clang-1103.0.32.62)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/user/Downloads/TEMP/IMG_3599.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2020-09-21T09:45:27.000000Z
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone 7
com.apple.quicktime.software: 13.4.1
com.apple.quicktime.creationdate: 2020-06-15T11:59:36+0200
com.apple.photos.originating.signature: AXfhZgW4nrUdSusOMUuJRarfxD7R
Duration: 00:01:13.40, start: 0.000000, bitrate: 10616 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 96 kb/s (default)
Metadata:
creation_time : 2020-09-21T09:45:27.000000Z
handler_name : Core Media Audio
Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 10514 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2020-09-21T09:45:27.000000Z
handler_name : Core Media Video
encoder : H.264
Stream #0:2(und): Data: none (mebx / 0x7862656D) (default)
Metadata:
creation_time : 2020-09-21T09:45:27.000000Z
handler_name : Core Media Metadata
Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2020-09-21T09:45:27.000000Z
handler_name : Core Media Metadata
Stream mapping:
Stream #0:0 -> #0:0 (aac (native) -> aac (native))
Stream #0:1 -> #0:1 (h264 (native) -> h264 (libx264))
Stream #0:2 -> #0:2 (copy)
Stream #0:3 -> #0:3 (copy)
Stream #0:0 -> #0:4 (aac (native) -> aac (native))
Stream #0:1 -> #0:5 (h264 (native) -> h264 (libx264))
Stream #0:2 -> #0:6 (copy)
Stream #0:3 -> #0:7 (copy)
Stream #0:0 -> #0:8 (aac (native) -> aac (native))
Stream #0:1 -> #0:9 (h264 (native) -> h264 (libx264))
Stream #0:2 -> #0:10 (copy)
Stream #0:3 -> #0:11 (copy)
Stream #0:0 -> #0:12 (aac (native) -> aac (native))
Stream #0:1 -> #0:13 (h264 (native) -> h264 (libx264))
Stream #0:2 -> #0:14 (copy)
Stream #0:3 -> #0:15 (copy)
Stream #0:0 -> #0:16 (aac (native) -> aac (native))
Stream #0:1 -> #0:17 (h264 (native) -> h264 (libx264))
Stream #0:2 -> #0:18 (copy)
Stream #0:3 -> #0:19 (copy)
Stream #0:0 -> #0:20 (aac (native) -> aac (native))
Stream #0:1 -> #0:21 (h264 (native) -> h264 (libx264))
Stream #0:2 -> #0:22 (copy)
Stream #0:3 -> #0:23 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x7f9c8980a600] using SAR=1/1
[libx264 @ 0x7f9c8980a600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f9c8980a600] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x7f9c8980a600] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=2933 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x7f9c88008e00] using SAR=640/639
[libx264 @ 0x7f9c88008e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f9c88008e00] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x7f9c88008e00] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=3422 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x7f9c8800fe00] using SAR=1/1
[libx264 @ 0x7f9c8800fe00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f9c8800fe00] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x7f9c8800fe00] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=4107 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x7f9c88014c00] using SAR=1280/1281
[libx264 @ 0x7f9c88014c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f9c88014c00] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x7f9c88014c00] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=5134 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x7f9c88019a00] using SAR=1/1
[libx264 @ 0x7f9c88019a00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f9c88019a00] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x7f9c88019a00] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=6845 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x7f9c8801e800] using SAR=1/1
[libx264 @ 0x7f9c8801e800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f9c8801e800] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x7f9c8801e800] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=10268 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[dash @ 0x7f9c8980fc00] Opening '/Applications/MAMP/htdocs/app/public/videos/IMG_3599/video_init_0.m4s' for writing
[dash @ 0x7f9c8980fc00] Opening '/Applications/MAMP/htdocs/app/public/videos/IMG_3599/video_init_1.m4s' for writing
[dash @ 0x7f9c8980fc00] No bit rate set for stream 2
[dash @ 0x7f9c8980fc00] Opening '/Applications/MAMP/htdocs/app/public/videos/IMG_3599/video_init_2.m4s' for writing
[mp4 @ 0x7f9c8a3a1e00] Could not find tag for codec none in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:21 --
[aac @ 0x7f9c89809400] Qavg: 880.111
[aac @ 0x7f9c89809400] 2 frames left in the queue on closing
[libx264 @ 0x7f9c8980a600] final ratefactor: 6.69
[aac @ 0x7f9c8981e800] Qavg: 880.111
[aac @ 0x7f9c8981e800] 2 frames left in the queue on closing
[libx264 @ 0x7f9c88008e00] final ratefactor: 9.83
[aac @ 0x7f9c8800ec00] Qavg: 880.111
[aac @ 0x7f9c8800ec00] 2 frames left in the queue on closing
[libx264 @ 0x7f9c8800fe00] final ratefactor: 11.81
[aac @ 0x7f9c88013a00] Qavg: 880.111
[aac @ 0x7f9c88013a00] 2 frames left in the queue on closing
[libx264 @ 0x7f9c88014c00] final ratefactor: 12.32
[aac @ 0x7f9c88018800] Qavg: 880.111
[aac @ 0x7f9c88018800] 2 frames left in the queue on closing
[libx264 @ 0x7f9c88019a00] final ratefactor: 13.29
[aac @ 0x7f9c8801d600] Qavg: 880.111
[aac @ 0x7f9c8801d600] 2 frames left in the queue on closing
[libx264 @ 0x7f9c8801e800] final ratefactor: 13.32
Conversion failed!

To Reproduce

$ffmpeg = FFMpeg::create([
'ffmpeg.binaries' => '/usr/local/bin/ffmpeg',
'ffprobe.binaries' => '//usr/local/bin/ffprobe',
'timeout' => 3600, // The timeout for the underlying process
'ffmpeg.threads' => 12,   // The number of threads that FFmpeg should use
]);

$video = $ffmpeg->open('mov file path');
$video->x264()
->autoGenerateRepresentations()
->save('output file path');

Expected behavior
No error :)

Desktop/Server (please complete the following information):

  • OS: Mac
  • Version: 10.15.6
  • FFmpeg vesion 4.3.1
@secit-pl secit-pl changed the title iPhone mMOV files processing problem iPhone MOV files processing problem Sep 21, 2020
@secit-pl
Copy link
Author

To fix this problem I had to remove all streams from the video file.

This stacoverflow answer helps me to build the proper ffmpeg command to prepare video file before processing it by the bundle https://stackoverflow.com/a/38162168/10561527 .

IMO this should be a part of the bundle - remove all non-audio/video streams before processing.

@aminyazdanpanah
Copy link
Member

The problem is the same as #48. I think FFmpeg has a bug in this case and I have not found a valid solution.

I will try to reach out to FFmpeg developers and report this bug.

@secit-pl
Copy link
Author

@aminyazdanpanah the solution (walkaround) is to remove all data streams before processing the video.

@aminyazdanpanah
Copy link
Member

@secit-pl I know it can remove all data streams from a video and then encode it but I think it is not an efficient way. I am looking for a better solution.

By the way, thanks for your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants