from https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs <https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs>
Tee pseudo-muxer <https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs#Teepseudo-muxer> The tee pseudo-muxer <https://ffmpeg.org/ffmpeg-formats.html#tee> was added to ffmpeg on 2013-02-03, and allows you to duplicate the output to multiple files with a single instance of ffmpeg. ffmpeg -i input.file -c:v libx264 -c:a mp2 \ -f tee -map 0:v -map 0:a "output.mkv|[f=mpegts]udp://10.0.1.255:1234/" so in your case the command should be something like this (untested): $ ffmpeg -y -deinterlace -f dv -i - -s 320x240 -r 10 -b:v 1000k -c:v libx264 -pix_fmt yuv420p -preset veryfast -crf 25 -maxrate 3000k -bufsize 6000k -g 20 -c:a libmp3lame -ac 1 -ab 32k -ar 22050 -f tee -map 0:v -map 0:a “recording.mp4|[f=flv]rtmp://xxx.xxx.xxx.xxx:1935/live/livestream1 <rtmp://xxx.xxx.xxx.xxx:1935/live/livestream1>" > On Apr 25, 2015, at 12:18 PM, Anthony Griffiths <[email protected]> wrote: > > this post is a continuation of a previous thread (of mine) about > encoding to multiple targets. I'm trying to create a stream and record > it too in one command, this is the command I'm using: > > ffmpeg -i [input] blah-de-blah > '[f=flv]rtmp://xxx.xxx.xxx.xxx:1935/live/livestream1|recording.mp4 > > this is the console output: > > ]$ ffmpeg -deinterlace -f dv -i - -f flv -y -vcodec flv -s 320x240 -r > 10 -b:v 1000k -vcodec libx264 -pix_fmt yuv420p -preset veryfast -crf > 25 -maxrate 3000k -bufsize 6000k -g 20 -c:a libmp3lame -ac 1 -ab 32k > -ar 22050 -f tee -map 0:v -map 0:a > '[f=flv]rtmp://xxx.xxx.xxx.xxx:1935/live/livestream1|recording.mp4' > ffmpeg version 2.6.2- http://johnvansickle.com/ffmpeg/ Copyright > (c) 2000-2015 the FFmpeg developers > built with gcc 4.9.2 (Debian 4.9.2-10) > configuration: --enable-gpl --enable-version3 --disable-shared > --disable-debug --enable-runtime-cpudetect --enable-libmp3lame > --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex > --enable-libvorbis --enable-libvpx --enable-libfreetype > --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb > --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc > --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg > --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab > --enable-libsoxr --cc=gcc-4.9 > libavutil 54. 20.100 / 54. 20.100 > libavcodec 56. 26.100 / 56. 26.100 > libavformat 56. 25.101 / 56. 25.101 > libavdevice 56. 4.100 / 56. 4.100 > libavfilter 5. 11.102 / 5. 11.102 > libswscale 3. 1.101 / 3. 1.101 > libswresample 1. 1.100 / 1. 1.100 > libpostproc 53. 3.100 / 53. 3.100 > Found AV/C device with GUID 0x002011011501d694 > Waiting for DV... > Capture Started > Input #0, dv, from 'pipe:': > Duration: N/A, start: 0.000000, bitrate: 28800 kb/s > Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], > 28800 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc > Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s > [libx264 @ 0x2a06580] using SAR=1/1 > [libx264 @ 0x2a06580] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 > [libx264 @ 0x2a06580] profile High, level 3.0 > [flv @ 0x2ff43c0] Codec for stream 0 does not use global headers but > container format requires global headers > [flv @ 0x2ff43c0] Codec for stream 1 does not use global headers but > container format requires global headers > [mp4 @ 0x2ff6fc0] Codec for stream 0 does not use global headers but > container format requires global headers > [mp4 @ 0x2ff6fc0] Codec for stream 1 does not use global headers but > container format requires global headers > Output #0, tee, to > '[f=flv]rtmp://xxx.xxx.xxx.xxx:1935/live/livestream1|recording.mp4': > Metadata: > encoder : Lavf56.25.101 > Stream #0:0: Video: h264 (libx264), yuv420p, 320x240 [SAR 1:1 DAR > 4:3], q=-1--1, 1000 kb/s, 10 fps, 10 tbn, 10 tbc > Metadata: > encoder : Lavc56.26.100 libx264 > Stream #0:1: Audio: mp3 (libmp3lame), 22050 Hz, mono, s16p, 32 kb/s > Metadata: > encoder : Lavc56.26.100 libmp3lame > Stream mapping: > Stream #0:0 -> #0:0 (dvvideo (native) -> h264 (libx264)) > Stream #0:1 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame)) > frame= 87 fps= 12 q=27.0 size=N/A time=00:00:08.43 bitrate=N/A dup=0 > drop=126 > > this command actually runs but the rtmp output is black, and I notice > that bitrate=N/A. The resultant recording.mp4 does have an image but > not the rtmp stream. I've been trawling google on this but can't work > out why this is. if I trim the command down and leave out the dual > target and just stream to rtmp only it works fine, I get an image. Can > anybody help? I've been on this problem for days and now I'm close to > solving if I can just get the rtmp image back on. Thanks for any > further help. > _______________________________________________ > ffmpeg-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/ffmpeg-user _______________________________________________ ffmpeg-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-user
