[FFmpeg-user] ffmpeg - transcode 4k mp4 (mp42) and GOPro 4k (mp41) to Apple hls
John Meah
johnmeah at memreas.com
Tue Sep 15 02:35:26 CEST 2015
Hi,
I am trying to transcode standard 4k and GOPro 4k to Apple HLS. I can transcode both to mp4 using libx265 along with standard movies (mp4, mov, avi, etc.) even HLS was working with my original libx264 codec command but somehow it’s not working so I’m starting fresh.
Here is the ffprobe info from the standard 4k video:
# ./ffprobe 4k_fireworks_2160p_Club-2013-Taipei.mp4
ffprobe version git-2015-09-13-d13a2df Copyright (c) 2007-2015 the FFmpeg developers
built with gcc 5.1.1 (GCC) 20150612 (Red Hat 5.1.1-3)
configuration: --prefix=/var/www/memreas_ffmpeg_install.bak/ffmpeg_build --extra-cflags='-I /var/www/memreas_ffmpeg_install.bak/ffmpeg_build/include' --extra-ldflags='-L /var/www/memreas_ffmpeg_install.bak/ffmpeg_build/lib' --bindir=/var/www/memreas_ffmpeg_install.bak/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265
libavutil 55. 2.100 / 55. 2.100
libavcodec 57. 1.100 / 57. 1.100
libavformat 57. 0.100 / 57. 0.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 3.100 / 6. 3.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '4k_fireworks_2160p_Club-2013-Taipei.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
Duration: 00:01:47.21, start: 0.000000, bitrate: 95742 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 447 kb/s (default)
Metadata:
handler_name : Sound Media Handler
Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 95290 kb/s, 29.97 fps, 29.97 tbr, 60k tbn, 59.94 tbc (default)
Metadata:
handler_name : Video Media Handler
encoder : AVC Coding
Here is the original command I used that once worked but no longer does:
#url: http://4ksamples.com/4k-uhd-fireworks-sample/
#original - works on all but 4k - Note: I re-compiled ffmpeg on fedora and may have re-downloaded the sample.
ffmpeg -re -y -i 4k_fireworks_2160p_Club-2013-Taipei.mp4
-threads 0
-map 0
-pix_fmt yuv420p
-vcodec libx264
-acodec libfdk_aac
-r 25
-profile:v main -level 4.0
-b:v 1500k
-maxrate 2000k
-force_key_frames 50
-flags -global_header
-f segment
-segment_list_type m3u8
-segment_list 4k_fireworks_2160p_Club-2013-Taipei.m3u8
-segment_time 10
-segment_format mpeg_ts 4k_fireworks_2160p_Club-2013-Taipei%05d.ts
2>&1
Here is the command I am currently trying:
#New - Note: I tried to switch the map given the streams from the original since audio is mapped as 0:0 and video is 0:1
ffmpeg -re -y -i 4k_fireworks_2160p_Club-2013-Taipei.mp4
-threads 0
-map 0:0
-map 0:1
-acodec libfdk_aac
-r 25 -b:v 1500k
-maxrate 2000k
-pix_fmt yuv420p
-vcodec libx264
-vf scale=1920:1080
-crf 20
-preset veryfast
-f segment
-segment_list_type m3u8
-segment_list 4k_fireworks_2160p_Club-2013-Taipei.m3u8
-segment_time 10
-segment_format mpeg_ts 4k_fireworks_2160p_Club-2013-Taipei%05d.ts
2>&1
Here is the error I received for the new command:
ffmpeg version git-2015-09-13-d13a2df Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.1.1 (GCC) 20150612 (Red Hat 5.1.1-3)
configuration: --prefix=/var/www/my_ffmpeg_install.bak/ffmpeg_build --extra-cflags='-I /var/www/my_ffmpeg_install.bak/ffmpeg_build/include' --extra-ldflags='-L /var/www/my_ffmpeg_install.bak/ffmpeg_build/lib' --bindir=/var/www/my_ffmpeg_install.bak/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265
libavutil 55. 2.100 / 55. 2.100
libavcodec 57. 1.100 / 57. 1.100
libavformat 57. 0.100 / 57. 0.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 3.100 / 6. 3.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/ephemeral0/ae40f98c-a8dc-4699-8fb8-a0059f60c91b/media/4k_fireworks_2160p_Club-2013-Taipei.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
Duration: 00:01:47.21, start: 0.000000, bitrate: 95742 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 447 kb/s (default)
Metadata:
handler_name : Sound Media Handler
Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 95290 kb/s, 29.97 fps, 29.97 tbr, 60k tbn, 59.94 tbc (default)
Metadata:
handler_name : Video Media Handler
encoder : AVC Coding
[libx264 @ 0x27c9480] VBV maxrate specified, but no bufsize, ignored
[libx264 @ 0x27c9480] using SAR=1/1
[libx264 @ 0x27c9480] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x27c9480] profile High, level 4.0
[libx264 @ 0x27c9480] 264 - core 148 r2 e86f3a1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, segment, to '/var/www/ephemeral0/ae40f98c-a8dc-4699-8fb8-a0059f60c91b/media/hls/4k_fireworks_2160p_Club-2013-Taipei%05d.ts':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
encoder : Lavf57.0.100
Stream #0:0(und): Audio: aac (libfdk_aac), 48000 Hz, stereo, s16, 139 kb/s (default)
Metadata:
handler_name : Sound Media Handler
encoder : Lavc57.1.100 libfdk_aac
Stream #0:1(und): Video: h264 (libx264), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 1500 kb/s, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
handler_name : Video Media Handler
encoder : Lavc57.1.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (aac (native) -> aac (libfdk_aac))
Stream #0:1 -> #0:1 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.53 bitrate=N/A
frame= 2 fps=1.9 q=0.0 size=N/A time=00:00:00.93 bitrate=N/A
Past duration 0.663322 too large
Past duration 0.829155 too large
frame= 14 fps=9.0 q=0.0 size=N/A time=00:00:00.93 bitrate=N/A dup=0 drop=1
frame= 21 fps= 10 q=25.0 size=N/A time=00:00:00.93 bitrate=N/A dup=0 drop=2
frame= 27 fps= 10 q=25.0 size=N/A time=00:00:01.92 bitrate=N/A dup=0 drop=3
frame= 32 fps= 10 q=25.0 size=N/A time=00:00:01.92 bitrate=N/A dup=0 drop=4
frame= 39 fps= 10 q=25.0 size=N/A time=00:00:01.92 bitrate=N/A dup=0 drop=6
frame= 45 fps= 10 q=25.0 size=N/A time=00:00:01.92 bitrate=N/A dup=0 drop=7
frame= 49 fps= 10 q=25.0 size=N/A time=00:00:02.17 bitrate=N/A dup=0 drop=8
frame= 53 fps=9.8 q=25.0 size=N/A time=00:00:02.92 bitrate=N/A dup=0 drop=9
frame= 57 fps=9.6 q=25.0 size=N/A time=00:00:02.92 bitrate=N/A dup=0 drop=9
frame= 59 fps=9.1 q=25.0 size=N/A time=00:00:02.92 bitrate=N/A dup=0 drop=10
frame= 61 fps=8.6 q=25.0 size=N/A time=00:00:02.92 bitrate=N/A dup=0 drop=10
frame= 64 fps=8.1 q=25.0 size=N/A time=00:00:02.92 bitrate=N/A dup=0 drop=11
frame= 66 fps=7.7 q=25.0 size=N/A time=00:00:02.92 bitrate=N/A dup=0 drop=11
frame= 68 fps=7.5 q=25.0 size=N/A time=00:00:02.92 bitrate=N/A dup=0 drop=12
frame= 70 fps=7.1 q=25.0 size=N/A time=00:00:02.92 bitrate=N/A dup=0 drop=12
frame= 73 fps=6.9 q=25.0 size=N/A time=00:00:02.92 bitrate=N/A dup=0 drop=12
frame= 75 fps=6.7 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=13
frame= 77 fps=6.5 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=13
frame= 78 fps=6.3 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=13
frame= 81 fps=6.2 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=14
frame= 83 fps=6.0 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=14
frame= 86 fps=6.0 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=15
frame= 88 fps=5.9 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=15
frame= 91 fps=5.9 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=16
frame= 93 fps=5.7 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=16
frame= 95 fps=5.7 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=17
frame= 97 fps=5.6 q=25.0 size=N/A time=00:00:03.90 bitrate=N/A dup=0 drop=17
frame= 98 fps=5.5 q=25.0 size=N/A time=00:00:04.24 bitrate=N/A dup=0 drop=17
frame= 101 fps=5.5 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=18
frame= 103 fps=5.4 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=18
frame= 105 fps=5.3 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=19
frame= 107 fps=5.3 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=19
frame= 108 fps=5.2 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=19
frame= 111 fps=5.2 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=20
frame= 113 fps=5.1 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=20
frame= 117 fps=5.1 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=21
frame= 118 fps=5.0 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=21
frame= 121 fps=5.0 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=22
frame= 123 fps=5.0 q=25.0 size=N/A time=00:00:04.88 bitrate=N/A dup=0 drop=22
#######
# cut similar frame messages to reduce error message size…
#######
frame= 2652 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=525
frame= 2653 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=525
frame= 2655 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=526
frame= 2656 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=526
frame= 2658 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=526
frame= 2659 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=527
frame= 2660 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=527
frame= 2662 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=527
frame= 2663 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=527
frame= 2663 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=527
frame= 2666 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=528
frame= 2668 fps=2.5 q=25.0 size=N/A time=00:01:46.64 bitrate=N/A dup=0 drop=528
frame= 2670 fps=2.5 q=25.0 size=N/A time=00:01:47.13 bitrate=N/A dup=0 drop=529
frame= 2671 fps=2.5 q=25.0 size=N/A time=00:01:47.13 bitrate=N/A dup=0 drop=529
frame= 2672 fps=2.5 q=25.0 size=N/A time=00:01:47.13 bitrate=N/A dup=0 drop=529
frame= 2673 fps=2.5 q=25.0 size=N/A time=00:01:47.13 bitrate=N/A dup=0 drop=529
frame= 2675 fps=2.4 q=25.0 size=N/A time=00:01:47.13 bitrate=N/A dup=0 drop=530
frame= 2677 fps=2.4 q=25.0 size=N/A time=00:01:47.13 bitrate=N/A dup=0 drop=530
frame= 2678 fps=2.4 q=25.0 size=N/A time=00:01:47.13 bitrate=N/A dup=0 drop=530
frame= 2679 fps=2.4 q=25.0 size=N/A time=00:01:47.15 bitrate=N/A dup=0 drop=531
frame= 2682 fps=2.4 q=25.0 size=N/A time=00:01:47.15 bitrate=N/A dup=0 drop=531
frame= 2682 fps=2.4 q=25.0 size=N/A time=00:01:47.15 bitrate=N/A dup=0 drop=531
frame= 2682 fps=2.4 q=-1.0 Lsize=N/A time=00:01:47.20 bitrate=N/A dup=0 drop=531
video:104327kB audio:1828kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x27c9480] frame I:17 Avg QP:16.96 size:258008
[libx264 @ 0x27c9480] frame P:1601 Avg QP:20.78 size: 55034
[libx264 @ 0x27c9480] frame B:1064 Avg QP:22.08 size: 13472
[libx264 @ 0x27c9480] consecutive B-frames: 29.6% 50.5% 6.4% 13.6%
[libx264 @ 0x27c9480] mb I I16..4: 37.5% 19.9% 42.6%
[libx264 @ 0x27c9480] mb P I16..4: 10.4% 5.0% 0.4% P16..4: 35.9% 9.8% 8.4% 0.0% 0.0% skip:30.2%
[libx264 @ 0x27c9480] mb B I16..4: 1.2% 0.5% 0.0% B16..8: 11.4% 4.4% 1.2% direct:15.5% skip:65.7% L0:26.8% L1:48.2% BI:25.0%
[libx264 @ 0x27c9480] 8x8 transform intra:31.0% inter:27.3%
[libx264 @ 0x27c9480] coded y,uvDC,uvAC intra: 35.5% 64.5% 25.9% inter: 18.3% 27.9% 3.3%
[libx264 @ 0x27c9480] i16 v,h,dc,p: 56% 19% 20% 5%
[libx264 @ 0x27c9480] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 9% 61% 3% 3% 3% 3% 2% 3%
[libx264 @ 0x27c9480] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 17% 18% 7% 8% 8% 8% 7% 7%
[libx264 @ 0x27c9480] i8c dc,h,v,p: 60% 18% 19% 3%
[libx264 @ 0x27c9480] Weighted P-Frames: Y:14.1% UV:9.3%
[libx264 @ 0x27c9480] kb/s:7966.45
Lastly, Here is the output from a GOPro video (Hero Black):
# I don’t have a command for this one.
ffprobe -i GOPR0044.MP4
ffprobe version git-2015-09-13-d13a2df Copyright (c) 2007-2015 the FFmpeg developers
built with gcc 5.1.1 (GCC) 20150612 (Red Hat 5.1.1-3)
configuration: --prefix=/var/www/memreas_ffmpeg_install.bak/ffmpeg_build --extra-cflags='-I /var/www/memreas_ffmpeg_install.bak/ffmpeg_build/include' --extra-ldflags='-L /var/www/memreas_ffmpeg_install.bak/ffmpeg_build/lib' --bindir=/var/www/memreas_ffmpeg_install.bak/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265
libavutil 55. 2.100 / 55. 2.100
libavcodec 57. 1.100 / 57. 1.100
libavformat 57. 0.100 / 57. 0.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 3.100 / 6. 3.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR0044.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2015-08-08 14:35:29
Duration: 00:01:13.97, start: 0.000000, bitrate: 60112 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 59964 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2015-08-08 14:35:29
handler_name : GoPro AVC
encoder : GoPro AVC encoder
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
creation_time : 2015-08-08 14:35:29
handler_name : GoPro AAC
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2015-08-08 14:35:29
handler_name : GoPro TCD
timecode : 14:34:47:02
Stream #0:3(eng): Data: none (fdsc / 0x63736466), 9 kb/s (default)
Metadata:
creation_time : 2015-08-08 14:35:29
handler_name : GoPro SOS
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3
Any help is much appreciated!
Thanks,
JT
More information about the ffmpeg-user
mailing list