[FFmpeg-user] Should ffmpeg automatically detect live_flv?

2022-11-29 Thread Marian Klymov
Hi,

While trying to build ffmpeg without parts that I don't use, I've
noticed that without flv demuxer ffmpeg can't automatically use
live_flv. Is this intended behavior? If I build ffmpeg with both flv
and live_flv, ffmpeg automatically uses flv.

I'm attaching log files.

0_without_flv.txt - no explicit type, only live_flv demuxer is
present - fails.
1_live_flv_explicit.txt - -f live_flv, only live_flv demuxer is
present - works.
2_with_flv.txt - no explicit type, both flv and live_flv are
present, ffmpeg chooses flv - works.

Best regards,
Marian Klymov
ffmpeg -v debug -i rtmp://127.0.0.1/live/test
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219
  configuration: --enable-version3 --enable-gpl --enable-nonfree 
--disable-static --enable-shared --disable-everything 
--disable-runtime-cpudetect --disable-swscale-alpha --disable-ffplay 
--disable-ffprobe --disable-doc --disable-debug --enable-bsf=extract_extradata 
--enable-protocol=rtmp --enable-protocol=rtmps --enable-protocol=tls 
--enable-demuxer=live_flv --enable-muxer=flv --enable-decoder=h264 
--enable-decoder=aac --enable-parser=h264 --enable-parser=aac --enable-openssl 
--disable-iconv --extra-cflags='-march=native'
  libavutil  57. 28.100 / 57. 28.100
  libavcodec 59. 37.100 / 59. 37.100
  libavformat59. 27.100 / 59. 27.100
  libavdevice59.  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
  libpostproc56.  6.100 / 56.  6.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 
'debug'.
Reading option '-i' ... matched as input url with argument 
'rtmp://127.0.0.1/live/test'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtmp://127.0.0.1/live/test.
Successfully parsed a group of options.
Opening an input file: rtmp://127.0.0.1/live/test.
[NULL @ 0x7f861e0db0c0] Opening 'rtmp://127.0.0.1/live/test' for reading
[rtmp @ 0x7f861e043ec0] No default whitelist set
[tcp @ 0x7f861e01af00] No default whitelist set
[tcp @ 0x7f861e01af00] Original list of addresses:
[tcp @ 0x7f861e01af00] Address 127.0.0.1 port 1935
[tcp @ 0x7f861e01af00] Interleaved list of addresses:
[tcp @ 0x7f861e01af00] Address 127.0.0.1 port 1935
[tcp @ 0x7f861e01af00] Starting connection attempt to 127.0.0.1 port 1935
[tcp @ 0x7f861e01af00] Successfully connected to 127.0.0.1 port 1935
[rtmp @ 0x7f861e043ec0] Handshaking...
[rtmp @ 0x7f861e043ec0] Type answer 3
[rtmp @ 0x7f861e043ec0] Server version 13.14.10.13
[rtmp @ 0x7f861e043ec0] Proto = rtmp, path = /live/test, app = live, fname = 
test
[rtmp @ 0x7f861e043ec0] Window acknowledgement size = 500
[rtmp @ 0x7f861e043ec0] Max sent, unacked = 500
[rtmp @ 0x7f861e043ec0] New incoming chunk size = 4096
[rtmp @ 0x7f861e043ec0] Creating stream...
[rtmp @ 0x7f861e043ec0] Sending play command for 'test'
[AVIOContext @ 0x7f861dcf1a40] Statistics: 1081531 bytes read, 0 seeks
[rtmp @ 0x7f861e043ec0] Deleting stream...
rtmp://127.0.0.1/live/test: Invalid data found when processing input


ffmpeg -v debug -i rtmp://127.0.0.1/live/test
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219
  configuration: --enable-version3 --enable-gpl --enable-nonfree 
--disable-static --enable-shared --disable-everything 
--disable-runtime-cpudetect --disable-swscale-alpha --disable-ffplay 
--disable-ffprobe --disable-doc --disable-debug --enable-bsf=extract_extradata 
--enable-protocol=rtmp --enable-protocol=rtmps --enable-protocol=tls 
--enable-demuxer=flv --enable-demuxer=live_flv --enable-muxer=flv 
--enable-decoder=h264 --enable-decoder=aac --enable-parser=h264 
--enable-parser=aac --enable-openssl --disable-iconv 
--extra-cflags='-march=native'
  libavutil  57. 28.100 / 57. 28.100
  libavcodec 59. 37.100 / 59. 37.100
  libavformat59. 27.100 / 59. 27.100
  libavdevice59.  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
  libpostproc56.  6.100 / 56.  6.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 
'debug'.
Reading option '-i' ... matched as input url with argument 
'rtmp://127.0.0.1/live/test'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtmp://127.0.0.1/live/test.
Successfully parsed a group of options.
Opening an input file: rtmp://127.0.0.1/live/test.
[NULL @ 0x7f42783430c0] Opening 'rtmp://127.0.0.1/live/test' for reading
[rtmp

[FFmpeg-user] Fwd: Split stream in equal chunks

2021-07-18 Thread Marian Klymov
чт, 25 бер. 2021 о 18:12 Carl Zwanzig  пише:
> IRC isn't email, of course :); PB may be ok for sharing the text on IRC.
> Please take a look at the mailing list FAQ-
> https://ffmpeg.org/mailing-list-faq.html
>
> (which also tells us not to top-post)
>
> Later,
>
> z!


So I've come back to this task after some time. I've switched to
using Alpine with building ffmpeg from the latest snapshot.

I want to achieve such a workflow:
1) Have 24 * 60 * 2 chunks for each day in high and low quality.
Each chunk corresponds to 30-seconds period. Video should be black
if there was no input stream.
2) Afterwards I want to be able to cut/concatenate any part from all
this chunks as mp4.

Currently I'm using this command to save video every 30 seconds
(except first chunk), transcode it, save on disk and also restream
to another server:

ffmpeg -i rtmp://localhost/live/test -vsync passthrough -c:v libx264
-preset fast -crf 23 -b:v 6000k -minrate 6000k -maxrate 6000k
-vf "scale=1920:1080" -r 25 -g 25 -keyint_min 25 -sc_threshold 0
-codec:a aac -af "aresample=48000:async=1000" -ac 2 -b:a 128k
-reset_timestamps 1 -f tee -map 0
"[f=stream_segment:segment_atclocktime=1:segment_time=30:strftime=1]
/var/rec/%s.ts|[f=flv]rtmp://localhost/transcoded/test";

Having gop 25 has helped with segment sizes. Keyframe is inserted
every second and ffmpeg doesn't have any problems cutting segments.
The problem happens with concatenating parts. I'vetried to cut first
part, cut last part and then use ffconcat to glue everything together
without having to reencode. I'm using the same parameters to be able
to use "-c copy" afterwards. Example:
ffmpeg -y -i 00.ts -ss 01.10 -codec:v libx264 -preset fast
-crf 23 -b:v 6000k -minrate 6000k -maxrate 6000k -codec:a aac
-f mpegts tempchunkstart.ts

ffmpeg -y -i 000100.ts -codec:v libx264 -preset fast
-crf 23 -b:v 6000k -minrate 6000k -maxrate 6000k -codec:a aac
-to 05.00 -f mpegts tempchunkend.ts

Then I'm preparing input for ffconcat like
file 'tempchunk.ts'
file '30.ts'
file 'tempchunkend.ts'

ffmpeg -y -f concat -safe 0 -i concat_list.txt -c copy output.ts

Afterwards I'm converting .ts to .mp4

ffmpeg -i output.ts -map 0 -c copy output.mp4

The problem happens with the last audio frame between chunks. I'm
feeling that I'm doing something completely wrong. Should I somehow
tell ffmpeg explicitly to use timestamps from original .ts files?

Thanks for pointing me in the right direction,
Marian Klymov
___
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] Split stream in equal chunks

2021-03-25 Thread Marian Klymov
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
libpostproc55.  3.100 / 55.  3.100

Best regards,
Marian Klymov

чт, 25 бер. 2021 о 11:28 Carl Eugen Hoyos  пише:

> Am Do., 25. März 2021 um 08:03 Uhr schrieb Marian Klymov <
> nekto1...@gmail.com>:
> >
> > I want to receive rtmp stream (using nginx-rtmp module), transcode
> > it and save it in chunks.
> > I would like to have splitting at specific times and to have all chunks
> > equal to 30.00 seconds (except first and last obviously). I've tried
> > playing with different parameters. segment_atclocktime looked like
> > it should do what I want but it creates chunks of different sizes.
>
> Either I misunderstand or this makes no sense:
> You write that you want 30-second-chunks which is not unusual I
> guess. With each real encoder (like x264), each 30-second-chunk
> has a different size (in bytes). Then you write that you expect that
> your chunks all have the same size.
> You would that be possible?
>
> Generally, when asking questions here, always post the command
> line you used together with the complete, uncut console output in
> your email, do not use external resources.
>
> Carl Eugen
> ___
> 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".

[FFmpeg-user] Split stream in equal chunks

2021-03-25 Thread Marian Klymov
I want to receive rtmp stream (using nginx-rtmp module), transcode it and
save it in chunks.
I would like to have splitting at specific times and to have all chunks
equal to 30.00 seconds (except first and last obviously). I've tried
playing with different parameters. segment_atclocktime looked like it
should do what I want but it creates chunks of different sizes. Originally
I thought that this is because of keyframes, but even with -g 1 it fails
sometimes.
My last try looks like this https://pastebin.com/raw/dYED4YXQ Is it
possible to do such thing with ffmpeg or do I need to implement some
heuristics with trying to resplit chunks outside?
___
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".