Re: [FFmpeg-user] Generating HLS chunks on demand
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.ffmpeg.org/wiki/Seeking HTH Cyril Le lun. 23 janv. 2023 à 09:15, Vincent Deconinck a écrit : > 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 > This took a long time to process the full video of course, but the result > plays perfectly fine. > I then created a partial version limited to 12 seconds (=3 chunks of 4 > secs) from the same source, as follows: > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -t 12 > -f hls -hls_time 4 sample_part.m3u8 > > I performed a binary diff on the resulting ts files, and the chunks #0 and > #1 are exactly the same. > However, chunk #3 (which is the last of the "partial" version) is different > (375kB vs 392kB) : > > 1578 sample.m3u8 >190 sample_part.m3u8 > 582424 sample_part0.ts > 764972 sample_part1.ts > 383896 sample_part2.ts > 582424 sample0.ts > 764972 sample1.ts > 401004 sample2.ts > ... > > What is the reason for that difference, and how can I make sure I generate > a valid segment for those 4 seconds ? > > Kind regards, > > Vincent > > On Fri, Jan 20, 2023 at 5:44 PM Vincent Deconinck > wrote: > > > 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 resulting stream is choppy and basically unusable. > > Here are the commands I'm using:: > > > > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -ss > 0 > > -t 4 -f mpegts cache\sample-0.ts > > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -ss > 4 > > -t 4 -f mpegts cache\sample-1.ts > > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -ss > 8 > > -t 4 -f mpegts cache\sample-2.ts > > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -ss > > 12 -t 4 -f mpegts cache\sample-3.ts > > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -ss > > 16 -t 4 -f mpegts cache\sample-4.ts > > > > The m3u8 file is : > > > > #EXTM3U > > #EXT-X-VERSION:3 > > #EXT-X-TARGETDURATION:4 > > #EXT-X-MEDIA-SEQUENCE:0 > > #EXTINF:4.00, > > sample-0.ts > > #EXTINF:4.00, > > sample-1.ts > > #EXTINF:4,00, > > sample-2.ts > > #EXTINF:4,00, > > sample-3.ts > > #EXTINF:4,00, > > sample-4.ts > > #EXT-X-ENDLIST > > > > What am I doing wrong ? > > > > Kind Regards, > > > > Vincent > > > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Replace part of the audio
On 1/22/23, Reino Wijnsma wrote: > Hello Michael, > > On 2023-01-22T18:50:20+0100, Michael Koch > wrote: >> This command line works with asendcmd and astreamselect: >> >> ffmpeg -i audio1.wav -i audio2.wav -lavfi asendcmd="4 astreamselect map >> 1",asendcmd="6 astreamselect map 0",astreamselect=map=0 -y out.wav >> >> >> However with amix filter I have no idea what's the syntax for the string >> inside the string. It doesn't work. >> >> ffmpeg -i audio1.wav -i audio2.wav -lavfi asendcmd="4 amix weights '0 >> 1'",amix=weights='1 0' -y out.wav > > You've got your quotes all wrong. Always surround the complete filter-chain > with double quotes and use single quotes for the individual filters. > > ffmpeg -i audio1.wav -i audio2.wav -lavfi "asendcmd='4 astreamselect map > 1',asendcmd='6 astreamselect map 0',astreamselect=map=0" -y out.wav > > ffmpeg -i audio1.wav -i audio2.wav -lavfi "asendcmd='4 amix weights '\\\'0 > 1\\\',amix=weights='1 0'" -y out.wav > > See: http://ffmpeg.org/ffmpeg-all.html#Quoting-and-escaping and > http://ffmpeg.org/ffmpeg-all.html#Notes-on-filtergraph-escaping. > > On 2023-01-22T19:21:53+0100, Paul B Mahol wrote: >> there is way to escape stuff > > Can't you for once make a useful post?! I love you! ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Generating HLS chunks on demand
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 This took a long time to process the full video of course, but the result plays perfectly fine. I then created a partial version limited to 12 seconds (=3 chunks of 4 secs) from the same source, as follows: ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -t 12 -f hls -hls_time 4 sample_part.m3u8 I performed a binary diff on the resulting ts files, and the chunks #0 and #1 are exactly the same. However, chunk #3 (which is the last of the "partial" version) is different (375kB vs 392kB) : 1578 sample.m3u8 190 sample_part.m3u8 582424 sample_part0.ts 764972 sample_part1.ts 383896 sample_part2.ts 582424 sample0.ts 764972 sample1.ts 401004 sample2.ts ... What is the reason for that difference, and how can I make sure I generate a valid segment for those 4 seconds ? Kind regards, Vincent On Fri, Jan 20, 2023 at 5:44 PM Vincent Deconinck wrote: > 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 resulting stream is choppy and basically unusable. > Here are the commands I'm using:: > > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -ss 0 > -t 4 -f mpegts cache\sample-0.ts > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -ss 4 > -t 4 -f mpegts cache\sample-1.ts > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -ss 8 > -t 4 -f mpegts cache\sample-2.ts > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -ss > 12 -t 4 -f mpegts cache\sample-3.ts > ffmpeg -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k -g 25 -ss > 16 -t 4 -f mpegts cache\sample-4.ts > > The m3u8 file is : > > #EXTM3U > #EXT-X-VERSION:3 > #EXT-X-TARGETDURATION:4 > #EXT-X-MEDIA-SEQUENCE:0 > #EXTINF:4.00, > sample-0.ts > #EXTINF:4.00, > sample-1.ts > #EXTINF:4,00, > sample-2.ts > #EXTINF:4,00, > sample-3.ts > #EXTINF:4,00, > sample-4.ts > #EXT-X-ENDLIST > > What am I doing wrong ? > > Kind Regards, > > Vincent > ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] R: Black screen when capturing Windows desktop with audio (gdigrab, dshow)
> My tests show that this issue does not depend on the encoders. > I tested libx264 (with fast, veryfast, ultrafast presets)/aac and libvpx-vp9/libvorbis encoder combinations with the same result. the problem is that gdigrab is an obsolete module, it uses the old gdi technology of Windows XP. It should be updated to the new Windows Graphics Capture API method as I suggested here: https://trac.ffmpeg.org/ticket/9413 but noone seems interested. The new version of gstreamer has the plugin "d3d11screencapturesrc" which allows you to capture screens or individual windows easily and without any problems. On ffmpeg you can try ddagrab instead of gdigrab to see if you have better results Maurizio ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Replace part of the audio
Am 22.01.2023 um 23:52 schrieb Reino Wijnsma: Hello Michael, On 2023-01-22T18:50:20+0100, Michael Koch wrote: This command line works with asendcmd and astreamselect: ffmpeg -i audio1.wav -i audio2.wav -lavfi asendcmd="4 astreamselect map 1",asendcmd="6 astreamselect map 0",astreamselect=map=0 -y out.wav However with amix filter I have no idea what's the syntax for the string inside the string. It doesn't work. ffmpeg -i audio1.wav -i audio2.wav -lavfi asendcmd="4 amix weights '0 1'",amix=weights='1 0' -y out.wav You've got your quotes all wrong. Always surround the complete filter-chain with double quotes and use single quotes for the individual filters. ffmpeg -i audio1.wav -i audio2.wav -lavfi "asendcmd='4 astreamselect map 1',asendcmd='6 astreamselect map 0',astreamselect=map=0" -y out.wav ffmpeg -i audio1.wav -i audio2.wav -lavfi "asendcmd='4 amix weights '\\\'0 1\\\',amix=weights='1 0'" -y out.wav Thank you! Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".