[FFmpeg-user] how can I set limit_filesize or recording_timefor the specific output dynamically?

刘 岐 lingjiujianke at gmail.com
Tue Oct 15 14:42:58 CEST 2013


perhaps you need make the keyframe at every 3 second.

For example:

ffmpeg  -i input -force_key_frames 3,6,9,12,15,18,21,24 -vcodec libx264 -vprofile baseline -vlevel 1.0  -s 640x480 -b:v 800k -r 15  -pix_fmt yuv420p -acodec copy -strict -2 -f segment -segment_format mpegts -segment_time 3 -segment_list output.m3u8 -segment_list_flags live -map 0 -flags -global_header video-%d.ts

here are split at 00:00:03, 00:00:06……..00:00:24
you can wite a program to make the time to limit, and duration on three seconds.


Steven 


在 2013-10-15,下午1:42,Huang Soho <soho123.2012 at gmail.com> 写道:

> 2013/10/15 Jacky <690271929 at qq.com>
> 
>> you need add -map 0:VideoTrack
>> 
>> 
> 
> 
> hi
> yes ,that is right !
> but the option "segment_time" seems not have any function.
> when I set -segment_time 3, ffmpeg does not split multiple files by each 3
> seconds.
> the log :
> 
> ffmpeg -sn -f video4linux2 -r 30 -s 1280x720 -input_format h264 -i
> /dev/video1
> -vcodec copy http://localhost:8090/feed2.ffm -vcodec copy -map 0 -f
> segment -s
> egment_time 3 -segment_format mpegts /var/stream%05d.ts
> ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
>  built on Oct 15 2013 11:13:34 with gcc 4.4.7
>  configuration: --enable-cross-compile --cross-prefix=sdk-linux-
> --arch=mips --target-os=linux --disable-doc --disable-htmlpages
> --disable-manpages --disable-podpages --disable-txtpages --disable-mips32r2
> --enable-small --disable-ffprobe --disable-ffplay --disable-postproc
> --disable-runtime-cpudetect --disable-swscale-alpha --disable-mipsdspr1
> --disable-mipsdspr2 --disable-mipsfpu --enable-small --prefix=/ffmpeg/romfs
> --bindir=/ffmpeg/romfs --disable-bsfs --disable-filters --enable-gpl
> --enable-libx264 --extra-cflags=-fPIC
> --enable-filter='aformat,aresample,anull,copy,format,fps,framestep,resample'
> --disable-encoders
> --enable-encoder='mjpeg,h264,libx264,libx264rgb,yuv4,pcm_s16le,pcm_s16be,pcm_mulaw,wmav2,wmav1'
> --disable-decoders --enable-decoder='mjpeg,h264,yuv4' --disable-hwaccels
> --disable-muxers
> --enable-muxer='ffm,asf,asf_stream,rtsp,mjpeg,h264,wav,mpegts,se
> libavutil      52. 18.100 / 52. 18.100
>  libavcodec     54. 92.100 / 54. 92.100
>  libavformat    54. 63.104 / 54. 63.104
>  libavdevice    54.  3.103 / 54.  3.103
>  libavfilter     3. 42.103 /  3. 42.103
>  libswscale      2.  2.100 /  2.  2.100
>  libswresample   0. 17.102 /  0. 17.102
> [video4linux2,v4l2 @ 0x709350] Estimating duration from bitrate, this may
> be inaccurate
> Input #0, video4linux2,v4l2, from '/dev/video1':
>  Duration: N/A, start: 374.000000, bitrate: N/A
>    Stream #0:0: Video: h264, yuv420p, 1280x720, -5 kb/s, 30 fps, 30 tbr,
> 1000k tbn, 2000k tbc
> Tue Oct 15 11:28:07 2013 0.0.0.0 - - [GET] "/feed2.ffm HTTP/1.1" 200 32847
> Output #0, ffm, to 'http://localhost:8090/feed2.ffm':
>  Metadata:
>    creation_time   : now
>    encoder         : Lavf54.63.104
>    Stream #0:0: Video: h264, yuv420p, 1280x720, q=2-31, -5 kb/s, 30 fps,
> 1000k tbn, 1000k tbc
> Output #1, segment, to '/var/stream%05d.ts':
>  Metadata:
>    encoder         : Lavf54.63.104
>    Stream #1:0: Video: h264, yuv420p, 1280x720, q=2-31, -5 kb/s, 30 fps,
> 90k tbn, 1000k tbc
> Stream mapping:
>  Stream #0:0 -> #0:0 (copy)
>  Stream #0:0 -> #1:0 (copy)
> Press [q] to stop, [?] for help
> 
> 
> # ls /var/ -al
> -rw-r--r--    1 root     root      7128396 Oct 15 11:28 stream00000.ts
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list