[FFmpeg-devel] Issues while encoding a ts file to m3u8

James Darnley james.darnley at gmail.com
Fri Aug 2 22:03:00 EEST 2019


On 2019-08-02 15:55, Ramana Jajula wrote:
> Hi,
> 
> I am trying to encode my ts file m3u8 using my customised ffmpeg of version
> 4.1. I used below command to do encoding.
> 
> ffmpeg -re -threads 8 -i /videos/input.ts -vcodec libx264 -s 320x240 -b:v
> 512000 -maxrate 512000 -acodec libfdk_aac -b:a 32000 -ac 2 -ar 48000
> -force_key_frames 'expr:gte(t,n_forced*3)' -hls_flags single_file
> -hls_list_size 0 -hls_time 3 -fsize 400x222 -frames /frames/my_frames/
> -index /mpegindex/my_index.idx  -y /encoded/test/output.m3u8
> 
> My encoding was bad. The output printed to console is
>   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
> /videos/input.ts FPS 25.000000 0
> Input #0, mpegts, from '/videos/.input.ts':
>   Duration: 00:04:05.97, start: 85837.091689, bitrate: 1769 kb/s
>   Program 1
>     Stream #0:0[0x105]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
> yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn,
> 50 tbc
>     Stream #0:1[0x106]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz,
> stereo, fltp, 128 kb/s
> [libx264 @ 0x564a2f7cc480] VBV maxrate specified, but no bufsize, ignored
> [libx264 @ 0x564a2f7cc480] using SAR=4/3
> [libx264 @ 0x564a2f7cc480] using cpu capabilities: MMX2 SSE2Fast SSSE3
> SSE4.2
> [libx264 @ 0x564a2f7cc480] profile High, level 2.0
> [libx264 @ 0x564a2f7cc480] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC
> codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options:
> cabac=1 ref=3 debloc
> k=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=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 wei
> ghtb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40
> intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=512 ratetol=1.0
> qcomp=0.60 qpmin=0 qpmax=69 qpst
> ep=4 ip_ratio=1.40 aq=1:1.00
> [hls @ 0x564a2f7ccc40] Using AVStream.codec to pass codec parameters to
> muxers is deprecated, use AVStream.codecpar instead.
>     Last message repeated 1 times
> [hls @ 0x564a2f7ccc40] Opening '/encodedt/input.ts' for writing
> Output #0, hls, to '/encoded/output.m3u8':
>   Metadata:
>     encoder         : Lavf58.20.100
>     Stream #0:0: Video: h264 (libx264), yuv420p, 320x240 [SAR 4:3 DAR
> 16:9], q=-1--1, 512 kb/s, 25 fps, 90k tbn, 25 tbc
>     Metadata:
>       encoder         : Lavc58.35.100 libx264
>     Side data:
>       cpb: bitrate max/min/avg: 512000/0/512000 buffer size: 0 vbv_delay: -1
>     Stream #0:1: Audio: aac (libfdk_aac), 48000 Hz, stereo, s16, 32 kb/s
>     Metadata:
>       encoder         : Lavc58.35.100 libfdk_aac
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
>   Stream #0:1 -> #0:1 (ac3 (native) -> aac (libfdk_aac))
> Press [q] to stop, [?] for help
> frame=   34 fps=0.1 q=0.0 size=N/A time=00:05:02.11 bitrate=N/A dup=29
> drop=0 speed=0.567x
> [hls @ 0x564a2f7ccc40] Packets poorly interleaved, failed to avoid negative
> timestamp -3360 in stream 0.0.567x
> Try -max_interleave_delta 0 as a possible workaround.
> 
> Since the encoding speed is too slow I had to cancel the encoding process.
> I killed it,
> 
> What is the reason for this slow encoding process?
> 
> PS: My input file is of 1 hour duration.
> 

1 - Wrong mailing list.  This should probably be on ffmpeg-user.

2 - What configure options did you use for ffmpeg?  Why did you remove them?

3 - What "modifications" have you made"?

4 - What CPU do you have?  One without AVX is either old, or limited
(like Celerons and Pentiums)

5 - Why are you using an x264 from 2016?  Have you "modified" it too?

Next time just press 'q' to end encoding so we can see some stats.



More information about the ffmpeg-devel mailing list