Quicktime not preview and play a h264 aac encoded file - why? - ios

Quicktime show black window when I try to play an mp4 file.
The info shows the encoding as : H.264, AAC, QuickTime Text
The file plays fine with VLC. I need this file in my iTunes library so that I can stream it, hence the importance of this question.
Here is the log from ffprobe:
ffprobe 222.mp4
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --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-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --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-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '222.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
Duration: 00:00:15.11, start: 0.000000, bitrate: 1294 kb/s
Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720, 1162 kb/s, 20.72 fps, 25 tbr, 10240 tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 125 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]

Related

AVPlayer currentTime not match with the displayed frame after many seeking. (HLS Stream)

I have a m3u8 file which i want to use with HLS.
link to m3u8 file
My problem is that when i seek many times, the currentTime not match with the displayed frame. I experience that, the more seeking there is more difference. (it's like a constant +offset)
Our use case is very timing sensitive, we need to stop the videos at specific positions. For this we use the following code:
[_player addBoundaryTimeObserverForTimes:times
queue:dispatch_get_main_queue()
usingBlock:^{
weakSelf.player.rate = 0.0;
// The time is correct here, but the displayed frame is not sync with this time
CMTimeShow(weakSelf.player.currentTime);
}
]
I read that AVURLAssetPreferPreciseDurationAndTimingKey can help, but the currentTime still wrong.
NSDictionary<NSString *, id> *options = #{AVURLAssetPreferPreciseDurationAndTimingKey:#YES};
AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:url options:options];
AVPlayerItem *item = [AVPlayerItem playerItemWithAsset:urlAsset];
I also read that there is a problem with the m3u8 itself. (for example wrong GOP size.)
What is the reason for the incorrect currentTime, and how can i fix this?
ffprobe m3u8:
ffprobe https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.m3u8
ffprobe version 5.1 Copyright (c) 2007-2022 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --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-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --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-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
[hls # 0x152f04280] Skip ('#EXT-X-VERSION:3')
[hls # 0x152f04280] Skip ('#EXT-X-INDEPENDENT-SEGMENTS')
[hls # 0x152f04280] Opening 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_6000000bitrate.m3u8' for reading
[hls # 0x152f04280] Skip ('#EXT-X-VERSION:3')
[https # 0x154045000] Opening 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_15000000bitrate.m3u8' for reading
[hls # 0x152f04280] Skip ('#EXT-X-VERSION:3')
[https # 0x154045000] Opening 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1520p_33000000bitrate.m3u8' for reading
[hls # 0x152f04280] Skip ('#EXT-X-VERSION:3')
[hls # 0x152f04280] Opening 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_6000000bitrate_00001.ts' for reading
[hls # 0x152f04280] Opening 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_6000000bitrate_00002.ts' for reading
[hls # 0x152f04280] Opening 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_15000000bitrate_00001.ts' for reading
[hls # 0x152f04280] Opening 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_15000000bitrate_00002.ts' for reading
[hls # 0x152f04280] Opening 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1520p_33000000bitrate_00001.ts' for reading
[hls # 0x152f04280] Opening 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1520p_33000000bitrate_00002.ts' for reading
Input #0, hls, from 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.m3u8':
Duration: 00:49:43.00, start: 2.033367, bitrate: 0 kb/s
Program 0
Metadata:
variant_bitrate : 8133826
Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn
Metadata:
variant_bitrate : 8133826
Program 1
Metadata:
variant_bitrate : 18870392
Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn
Metadata:
variant_bitrate : 18870392
Program 2
Metadata:
variant_bitrate : 40776144
Stream #0:2: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 2704x1520 [SAR 1:1 DAR 169:95], 29.97 fps, 29.97 tbr, 90k tbn
Metadata:
variant_bitrate : 40776144
ffprobe original mp4:
ffprobe https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/finalized/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.mp4
ffprobe version 5.1 Copyright (c) 2007-2022 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --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-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --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-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/finalized/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.76.100
Duration: 00:49:42.81, start: 0.000000, bitrate: 36142 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 2486x1398, 36138 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]

MediaRecorder iOS Chrome does not obey the bitrate

I'm using MediaRecorder to record video from webcam and in case of safari (or iOS Chrome) output is mp4 file. The issue is that video from iOS chrome has huge bitrate.
Using recordrtc library, this code:
this.recorder = new RecordRTCPromisesHandler(new MediaStream([
this.ownStream.getVideoTracks()[0],
this.ownStream.getAudioTracks()[0]
]), {
type: 'video',
mimeType: 'video/mp4',
recorderType: MediaStreamRecorder,
audioBitsPerSecond: 48 * 1024,
videoBitsPerSecond: 384 * 1024,
});
await this.recorder.startRecording();
creates mp4 successfully, but result bitrate of output video is 92643 kb/s for 10 FPS video!
Full ffprobe output:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4': Metadata: major_brand : iso5 minor_version : 1 compatible_brands: isomiso5hlsf creation_time : 2021-12-14T14:52:28.000000Z Duration: 00:00:00.59, start: 0.000000, bitrate: 92643 kb/s Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc), 640x480, 97341 kb/s, 10.14 fps, 20 tbr, 600 tbn, 1200 tbc (default) Metadata: rotate : 90 creation_time : 2021-12-14T14:52:28.000000Z handler_name : Core Media Video Side data: displaymatrix: rotation of -90.00 degrees Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 2552 kb/s (default) Metadata: creation_time : 2021-12-14T14:52:28.000000Z handler_name : Core Media Audio
This is only a bug in RecordRTC. Working with vanilla mediarecorder and videoBitsPerSecond works on iOS.

How to keep video quality same as it is after merge intro image beggining to video using ffmpeg

I have selected high resolution video but once i run command the video resolution quality was changed and too poor quality's video i get as output video, but i don't would like to loose my video quality. let me share full command and complete log below:
Note: libx264 encoder is not supporting iOS, I'm getting failure error so i use h264_videotoolbox so i would like to get supported command with h264_videotoolbox encoder
Command:
ffmpeg -i test.MOV -loop 1 -t 5 -i 2.jpg -f lavfi -t 5 -i anullsrc
-filter_complex "[0:v]trim=0:5,drawbox=t=fill[base];[1][base]scale2ref=iw:ih:force_original_aspect_ratio=decrease:flags=spline[2nd][base2];[base2][2nd]overlay='(W-w)/2':'(H-h)/2'[padded];[padded][2:a][0:v][0:a]concat=n=2:v=1:a=1[v][a]"
-c:v h264_videotoolbox -c:a aac -map "[v]" -map "[a]" output.mp4
Complete log
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_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-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2021-03-07T06:36:17.000000Z
com.apple.quicktime.location.accuracy.horizontal: 30.000000
com.apple.quicktime.location.ISO6709: +23.1141+072.5768+061.729/
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone 6s
com.apple.quicktime.software: 14.3
com.apple.quicktime.creationdate: 2021-03-07T12:06:17+0530
Duration: 00:00:29.79, start: 0.000000, bitrate: 15778 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 15643 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2021-03-07T06:36:17.000000Z
handler_name : Core Media Video
vendor_id : [0][0][0][0]
encoder : H.264
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 89 kb/s (default)
Metadata:
creation_time : 2021-03-07T06:36:17.000000Z
handler_name : Core Media Audio
vendor_id : [0][0][0][0]
Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2021-03-07T06:36:17.000000Z
handler_name : Core Media Metadata
Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2021-03-07T06:36:17.000000Z
handler_name : Core Media Metadata
Stream #0:4(und): Data: none (mebx / 0x7862656D), 34 kb/s (default)
Metadata:
creation_time : 2021-03-07T06:36:17.000000Z
handler_name : Core Media Metadata
Input #1, image2, from '2.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 17347 kb/s
Stream #1:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 360x360 [SAR 72:72 DAR 1:1], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #2, lavfi, from 'anullsrc':
Duration: N/A, start: 0.000000, bitrate: 705 kb/s
Stream #2:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
Stream mapping:
Stream #0:0 (h264) -> trim
Stream #0:0 (h264) -> concat:in1:v0
Stream #0:1 (aac) -> concat:in1:a0
Stream #1:0 (mjpeg) -> scale2ref:default
Stream #2:0 (pcm_u8) -> concat:in0:a0
concat:out:v0 -> Stream #0:0 (h264_videotoolbox)
concat:out:a0 -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[swscaler # 0x7f976242b000] deprecated pixel format used, make sure you did set range correctly
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
com.apple.quicktime.creationdate: 2021-03-07T12:06:17+0530
com.apple.quicktime.location.accuracy.horizontal: 30.000000
com.apple.quicktime.location.ISO6709: +23.1141+072.5768+061.729/
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone 6s
com.apple.quicktime.software: 14.3
encoder : Lavf58.76.100
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, q=2-31, 200 kb/s, 29.97 fps, 30k tbn (default)
Metadata:
encoder : Lavc58.134.100 h264_videotoolbox
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
Metadata:
encoder : Lavc58.134.100 aac
frame= 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 12 fps=0.0 q=-0.0 size= 256kB time=00:00:00.32 bitrate=6452.4kbits/frame= 34 fps= 32 q=-0.0 size= 256kB time=00:00:01.02 bitrate=2053.0kbits/frame= 55 fps= 35 q=-0.0 size= 256kB time=00:00:01.74 bitrate=1204.4kbits/frame= 76 fps= 37 q=-0.0 size= 256kB time=00:00:02.46 bitrate= 852.2kbits/frame= 98 fps= 38 q=-0.0 size= 256kB time=00:00:03.18 bitrate= 659.4kbits/frame= 120 fps= 39 q=-0.0 size= 256kB time=00:00:03.90 bitrate= 537.7kbits/frame= 141 fps= 39 q=-0.0 size= 512kB time=00:00:04.62 bitrate= 907.8kbits/[out_0_0 # 0x7f975de0ae80] 100 buffers queued in out_0_0, something may be wrong.
[out_0_1 # 0x7f975de0a5c0] 100 buffers queued in out_0_1, something may be wrong.
frame= 301 fps= 67 q=-0.0 size= 768kB time=00:00:11.09 bitrate= 566.9kbits/frame= 406 fps= 81 q=-0.0 size= 1024kB time=00:00:14.60 bitrate= 574.4kbits/frame= 509 fps= 92 q=-0.0 size= 1280kB time=00:00:18.04 bitrate= 581.2kbits/frame= 604 fps=100 q=-0.0 size= 1792kB time=00:00:21.19 bitrate= 692.5kbits/frame= 705 fps=108 q=-0.0 size= 2048kB time=00:00:24.56 bitrate= 682.9kbits/frame= 809 fps=115 q=-0.0 size= 2304kB time=00:00:28.04 bitrate= 672.9kbits/frame= 909 fps=121 q=-0.0 size= 2816kB time=00:00:31.37 bitrate= 735.4kbits/frame= 1012 fps=126 q=-0.0 size= 3072kB time=00:00:34.71 bitrate= 725.0kbits/frame= 1043 fps=127 q=-0.0 Lsize= 3288kB time=00:00:34.78 bitrate= 774.3kbits/s speed=4.23x
video:2995kB audio:255kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.168448%
[aac # 0x7f9760024200] Qavg: 9569.656
The main video have a bitrate aprox of 15778K, and this is a signal for quality hight...
Duration: 00:00:29.79, start: 0.000000, bitrate: 15778 kb/s
You have to put bitrate parameter -b:v {bitrate, in this case 15778K} in your code to keep hight qualiy, some like
ffmpeg -i test.MOV -loop 1 -t 5 -i 2.jpg -f lavfi -t 5 -i anullsrc -filter_complex "[0:v]trim=0:5,drawbox=t=fill[base];[1][base]scale2ref=iw:ih:force_original_aspect_ratio=decrease:flags=spline[2nd][base2];[base2][2nd]overlay='(W-w)/2':'(H-h)/2'[padded];[padded][2:a][0:v][0:a]concat=n=2:v=1:a=1[v][a]" -c:v h264_videotoolbox -b:v 15778K -c:a aac -map "[v]" -map "[a]" output.mp4
NOTE: if have an error with "-c:a aac" parameter, remove it, because in Apple`s OS aac is for default because is an Apple codec
King Regards

FFmpeg concat produces bad Video

I have installed ffmpeg on a microsoft/dotnet:2.2-aspnetcore-runtime docker container using
1.apt-get update
2.apt-get install ffmpeg.
seems to be installed fine, but when I try and use it as such
ffmpeg -f concat -i /data/mylist.txt -c: copy /data/output.mp4
the output is that the first video part is ok, but the second colors are all messy (hard to explain) and when I change the order of the videos in the list still the first in the list is ok and the second is messed up.
p.s same settings on a different machine works (ffmpeg for ubuntu)
bad
[mov,mp4,m4a,3gp,3g2,mj2 # 0x55ccbcce90c0] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from '/data/mylist.txt':
Duration: N/A, start: 0.000000, bitrate: 14915 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 14915 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Metadata:
creation_time : 2014-10-17T04:06:30.000000Z
handler_name : GPAC ISO Video Handler
Output #0, mp4, to '/data/output.mp4':
Metadata:
encoder : Lavf57.56.101
Stream #0:0(und): Video: h264 (Constrained Baseline) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 14915 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc
Metadata:
creation_time : 2014-10-17T04:06:30.000000Z
handler_name : GPAC ISO Video Handler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
good
Input #0, concat, from '/data/mylist.txt':
Duration: N/A, start: 0.000000, bitrate: 14915 kb/s
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 14915 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Metadata:
creation_time : 2014-10-17T04:06:30.000000Z
handler_name : GPAC ISO Video Handler
Output #0, mp4, to '/data/outGood1.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 14915 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc
Metadata:
creation_time : 2014-10-17T04:06:30.000000Z
handler_name : GPAC ISO Video Handler
Stream mapping:
Stream #0:0 -> #0:0 (copy)

Video won't play on iphone

I have an app that places videos online, and cannot find a way to get iPhones to actually play them.
ffprobe says:
merc#mercs-thinkpad:/disk/home/merc/Downloads$ ffprobe 5801005ff1861ba1729757fbffprobe version 2.8.8-0ubuntu0.16.04.1 Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.2) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
WARNING: library configuration mismatch
avcodec configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-version3 --disable-doc --disable-programs --disable-avdevice --disable-avfilter --disable-avformat --disable-avresample --disable-postproc --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libvo_aacenc --enable-libvo_amrwbenc
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '5801005ff1861ba1729757fb':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.50.100
Duration: 00:00:12.37, start: 0.021333, bitrate: 993 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 928 kb/s, 29.83 fps, 29.83 tbr, 11456 tbn, 59.67 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 70 kb/s (default)
Metadata:
handler_name : SoundHandler
The video is here
The file was created using ffmpeg from within the app.
Is this a codec problem? What shall I do to make sure iPhones can actually play them?
Oh my... amazingly, it was the file name! Even though the mime type is set, if the file name is not .mp4, the file won't be treated as a movie file!
(Which is amazing to think about, if you know Apple's history...)

Resources