Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-31 Thread Vincent Deconinck
Hi, Here is my progress report. I wanted to understand why files (even the ones created with the hls muxer) cannot be played smoothly one after the other if they were generated by different runs. So I executed 13 HLS encodings (A-M) of different parts of the first 36 seconds of my sample file. I

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-30 Thread Vincent Deconinck
Hi all, Re-reading this thread and German's first answer in particular, I realized that there are two diffierent "segment" muxers: '-f segment' and '-f ssegment' (with double 's', for 'stream-segment') and decided to try playlists of ts files built by each of them, but none of them plays back OK.

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-30 Thread Vincent Deconinck
Hi Cyril, I remember that in the first tests I made before answering your first email > in this thread, I tried to use -ss and -t params with both ts and mp4 > output formats. The ts segments were seemingly random length whereas the > mp4 seemed strictly of the same length. Good to know. In fact

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-29 Thread Cyril Comparon
Hi Vincent Thank you so much for reporting the details of your journey. There seems to be something with the TS muxer that makes it hard to split a media into rigorously same-length segments. I remember that in the first tests I made before answering your first email in this thread, I tried to us

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-27 Thread Vincent Deconinck
Sorry, I got my tests mixed-up in the previous email :-( The command ffmpeg -ss 0 -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -x264opts "keyint=25:min-keyint=25:no-scenecut" -t 4 -f mpegts mpegts_fixed-0.ts creates a TS with *no missing frames*: mpegts_fixed-0.ts: IBBBPPBBPBPBPPBPBPPB

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-27 Thread Vincent Deconinck
Hi all, I tried analyzing the differences between the ts files generated "all at once" (using the hls muxer) and the ones generetad individually using -ss, -t and the mpegts muxer. I extracted the gop structure of the first ts segment using ffprobe then reformated it in IBBP format, and here are t

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-26 Thread Vincent Deconinck
Hi, OK, I made some progress, so replying to self : So although I'm forcing keyframes, the durations are actually not 4 seconds > (the EXT-X-TARGETDURATION field even says 5) > Is there another way to force all segments to be exactly the same duration > ? > After a bit of reading, the -g option

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-25 Thread Vincent Deconinck
Hi German So, my advice is the following: > 1. Produce a full set of HLS segments for your source file and save > them in some folder that is not accessible to your users (archive). > ... > Yes, that is the traditional way of doing it, but it would basically mean keeping a low res version of each

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-25 Thread Vincent Deconinck
Hi German, Thanks for your reply. > Do not use -ss and -t parameters simultaneously. FFmpeg cannot form an > output container well in that case. > I also think the -ss and -t options are the root cause of my issues, but I cannot see another way to generate only some segments (or are there "star

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-25 Thread German Geraskin
Hi Vincent, I have read your very first message and realized what you are going to achieve as a final result. So, my advice is the following: 1. Produce a full set of HLS segments for your source file and save them in some folder that is not accessible to your users (archive). 2. When the user re

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-25 Thread German Geraskin
Hi Vincent, Do not use -ss and -t parameters simultaneously. FFmpeg cannot form an output container well in that case. If you just need to create HLS segments from some source file you can use the "segment" muxer. ffmpeg -i source.mp4 -vcodec copy -acodec copy -f ssegment -segment_list chunklist

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-24 Thread Vincent Deconinck
Hi Cyril, Thanks a lot for your reply. I tried your suggestion and changed my first test to do frame accurate seeking by moving the -ss option upfront, like so: ffmpeg -ss 0 -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -t 4 -f mpegts sample_fa-0.ts ffmpeg -ss 4 -i source.ts -c:v

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-23 Thread Cyril Comparon
Hi Vincent I believe what you're looking for is frame-accurate seeking. To achieve that you have to do input seeking instead of output seeking. The former is achieved by specifying -ss before -i in your command line, whereas you're doing the latter by specifying -ss after -i. See https://trac.ffmp

Re: [FFmpeg-user] Generating HLS chunks on demand

2023-01-23 Thread Vincent Deconinck
Hi, I performed more tests thinking that maybe the -f mpegts did not create "hls-compliant" ts chunks (whatever that could mean). So I tried creating first a full hls with the following command : ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -f hls -hls_time 4 sample.m3u8 Th

[FFmpeg-user] Generating HLS chunks on demand

2023-01-20 Thread Vincent Deconinck
Hi, I have thousands of files that I would like to serve as HLS streams to a very small number of users (3-5), without having to process them all upfront. So I'm looking for a way to generate single HLS chunks (as opposed to a full HLS package) only when they are requested. My problem is the result