I have 10 yuv input and each yuv is a frame of WxH (ip0_WxH.yuv, ip1_WxH.yuv, ..., ip9_WxH.yuv)
I need to concatenate all 10 to create a final yuv output with all 10 frames in this.
Option 1:
I used below link to do so. But final yuv output is not proper from frame number 2 onwards.
Only first frame looks good. From frame number 2, the buffer address of chroma and luma has may be some wrong indexing and hence the display of the picture is wrong.
Converting more yuv frames to one yuv frame
cat *.yuv > movie.yuv
Option 2:
I tried to use FFMPEG to concatenate the yuvs together : https://trac.ffmpeg.org/wiki/Concatenate
$ cat mylist.txt
file 'ip0_WxH.yuv'
file 'ip1_WxH.yuv'
file 'ip2_WxH.yuv'
Desktop/danny$ ffmpeg -f rawvideo -f concat -safe 0 -i myfile.txt -c out.yuv
but got this error:
...
Trailing options were found on the commandline.
[IMGUTILS # 0x7fff4d92d720] Picture size 0x0 is invalid
[concat # 0x558b6c335900] Impossible to open 'ip0_WxH.yuv'
myfile.txt: Invalid argument
Can any one suggest the ffmpeg command to concatenate these YUVs together.
UPDATE:
As per the first answer suggested by llogan,
I used below command:
ffmpeg -f image2 -c:v rawvideo -pixel_format rgb24 -video_size 1344x968 -i ip%d_WxH.yuv output.yuv
Output
~/Desktop/danny$ ffmpeg -f image2 -c:v rawvideo -pixel_format rgb24 -video_size 1344x968 -i ip%d_WxH.yuv output.yuv
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, image2, from ' ip%d_WxH.yuv':
Duration: 00:00:00.16, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1344x968, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[rawvideo # 0x5623405f30c0] Invalid buffer size, packet size 2132928 < expected frame_size 3902976
Error while decoding stream #0:0: Invalid argument
[rawvideo # 0x5623405f30c0] Invalid buffer size, packet size 2132928 < expected frame_size 3902976
Error while decoding stream #0:0: Invalid argument
[rawvideo # 0x5623405f30c0] Invalid buffer size, packet size 2132928 < expected frame_size 3902976
Error while decoding stream #0:0: Invalid argument
[rawvideo # 0x5623405f30c0] Invalid buffer size, packet size 2132928 < expected frame_size 3902976
Error while decoding stream #0:0: Invalid argument
Finishing stream 0:0 without any data written to it.
Output #0, rawvideo, to 'output.yuv':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1344x968, q=2-31, 780595 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 rawvideo
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
Conversion failed!
Try different yuvformat.
As you are using yuv. So use either yuv422p or yuv420p depends upon your input yuv type.
Try this :
ffmpeg -f image2 -c:v rawvideo -pixel_format yuv420p -video_size 1344x968 -i ip%d_WxH.yuv out.yuv
Related
Similar to this question, I'm trying to stream to Youtube/Facebook live (rtmp) via Ffmpeg.
The server on which ffmpeg is installed receives a rtp stream (source of the stream uses Vp8 and opus as the codecs), i then use the sdp given below as input for the ffmpeg command
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=FFMPEG Test
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 56.15.102
m=audio 10004 RTP/AVP 111
a=rtpmap:111 OPUS/48000/2
m=video 10006 RTP/AVP 100
a=rtpmap:100 VP8/90000
a=fmtp:100 packetization-mode=1
Where 10004 and 10006 are the audio and video port of the rtp input stream.
I'm using the following FFMPEG command to stream to youtube/facebook live
ffmpeg -protocol_whitelist file,crypto,udp,rtp -i input.sdp -c:a aac -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -f flv "rtmp_url"
Log:
ffmpeg version 4.2.2-1build1~18.04.sav0 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix=/usr --extra-version='1build1~18.04.sav0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
[sdp # 0x56083912d340] Could not find codec parameters for stream 1 (Video: vp8, yuv420p): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, sdp, from 'input.sdp':
Metadata:
title : FFMPEG Test
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Stream #0:1: Video: vp8, yuv420p, 90k tbr, 90k tbn, 90k tbc
Codec AVOption profile () specified for output file #0 (youtube_rtmp_url) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption g (set the group of picture (GOP) size) specified for output file #0 (youtube_rtmp_url) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption preset (Configuration preset) specified for output file #0 (youtube_rtmp_url) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
Stream #0:0 -> #0:0 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, flv, to 'youtube_rtmp_url':
Metadata:
title : FFMPEG Test
encoder : Lavf58.29.100
Stream #0:0: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.54.100 aac
av_interleaved_write_frame(): Broken pipe 134.5kbits/s speed=2.35x
[flv # 0x5608391a7040] Failed to update header with correct duration.
[flv # 0x5608391a7040] Failed to update header with correct filesize.
Error writing trailer of youtube_rtmp_url: Broken pipe
size= 162kB time=00:00:09.86 bitrate= 134.2kbits/s speed=2.32x
video:0kB audio:155kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.493091%
[aac # 0x5608391a7ac0] Qavg: 247.499
Conversion failed!
I have verified that ffmpeg can read the stream, i used a different ffmpeg command to record the stream and that works well. Could someone please point out whats wrong or link to some documentation that might help?
I want to fast copy parts from an rmvb file without re-encoding. This command works fine with mp4 files but not with rmbv (I dropped start time and duration here) :
ffmpeg -i input -c copy output
when I use it with rmvb like this:
ffmpeg -i 1.rmvb -c copy 1.mp4
I get this error:
[mp4 # 00bb8980] Could not find tag for codec rv40 in stream #0, codec
not curre ntly supported in container Could not write header for
output file #0 (incorrect codec parameters ?): Invali d argument
Stream mapping: Stream #0:1 -> #0:0 (copy) Stream #0:0 -> #0:1
(copy)
I also tried this:
ffmpeg -i 1.rmvb -c copy 2.rmvb
and got this error:
[NULL # 04748980] Unable to find a suitable output format for '2.rmvb'
2.rmvb: Invalid argument
I tried this command:
ffmpeg -i 1.rmvb -c:v copy -c:a aac -strict experimental -b:a 128k 1.mp4
and got this error:
[mp4 # 046e0020] Could not find tag for codec rv40 in stream #0, codec
not curre ntly supported in container Could not write header for
output file #0 (incorrect codec parameters ?): Invali d argument Error
initializing output stream 0:1 -- [aac # 046e1bc0] Qavg: nan
Conversion failed!
I read this topic:
but the solution does not work for me.. After many trials, this is the command that worked (and took too long time):
ffmpeg -i 1.rmvb -c:v libx264 -b:a 32k output.mp4
But I do not want to re-encode the file. Any solution?
Edit:
I tried:
ffmpeg -i 1.rmvb -c copy 1.mkv
ffmpeg version N-86447-gfeb13ae Copyright (c) 2000-2017 the FFmpeg
developers built with gcc 7.1.0 (GCC) configuration: --enable-gpl
--enable-version3 --enable-cuda --enable-cuvid --e nable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth -- enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls
--enable-iconv
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-li bfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug -
-enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enabl e-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li bsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolam e --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable
-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib libavutil 55. 63.100 / 55. 63.100 libavcodec 57. 98.100 /
57. 98.100 libavformat 57. 73.100 / 57. 73.100 libavdevice 57. 7.100 / 57. 7.100 libavfilter 6. 92.100 / 6. 92.100 libswscale 4. 7.101 / 4. 7.101 libswresample 2. 8.100 /
2. 8.100 libpostproc 54. 6.100 / 54. 6.100 [rm # 033a7520] Invalid stream index 2 for index at pos 206099254 Input #0, rm, from
'1.rmvb': Metadata:
title : ArabSeed.CoM
author : ArabSeed.CoM
copyright : ArabSeed.CoM
comment :
ASMRuleBook : #($Bandwidth >= 0),Stream0Bandwidth = 64082, Stream1Bandwi dth = 285918;
Audiences : Easy RealMedia Tool's Audience;
audioMode : music
Creation Date : 4/22/2010 4:31:14
Description : This File is Created by Easy RealMedia Tools#!
Email : rick#redcheek.net
Generated By : Easy RealMedia Tools V1.8x
HomeWeb : http://redcheek.net
Keywords : ArabSeed.CoM
Modification Date: 4/22/2010 4:31:14
videoMode : normal Duration: 01:16:35.69, start: 0.000000, bitrate: 358 kb/s
Stream #0:0: Audio: cook (cook / 0x6B6F6F63), 44100 Hz, stereo, fltp, 64 kb/ s
Stream #0:1: Video: rv40 (RV40 / 0x30345652), yuv420p, 720x408, 280 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc Output #0, matroska, to
'1.mkv': Metadata:
title : ArabSeed.CoM
author : ArabSeed.CoM
copyright : ArabSeed.CoM
comment :
ASMRuleBook : #($Bandwidth >= 0),Stream0Bandwidth = 64082, Stream1Bandwi dth = 285918;
Audiences : Easy RealMedia Tool's Audience;
audioMode : music
Creation Date : 4/22/2010 4:31:14
Description : This File is Created by Easy RealMedia Tools#!
Email : rick#redcheek.net
Generated By : Easy RealMedia Tools V1.8x
HomeWeb : http://redcheek.net
Keywords : ArabSeed.CoM
Modification Date: 4/22/2010 4:31:14
videoMode : normal
encoder : Lavf57.73.100
Stream #0:0: Video: rv40 (RV40 / 0x30345652), yuv420p, 720x408, q=2-31, 280 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc
Stream #0:1: Audio: cook ([255][255][255][255] / 0xFFFFFFFF), 44100 Hz, ster eo, fltp, 64 kb/s Stream mapping: Stream #0:1 -> #0:0
(copy) Stream #0:0 -> #0:1 (copy) Press [q] to stop, [?] for help
[matroska # 05228980] The Matroska muxer does not yet support muxing
cook av_interleaved_write_frame(): Not yet implemented in FFmpeg,
patches welcome Error writing trailer of 1.mkv: Not yet implemented in
FFmpeg, patches welcome frame= 21 fps=0.0 q=-1.0 Lsize= 0kB
time=00:00:01.48 bitrate= 0.0kbits /s speed= 148x video:2kB
audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing ove
rhead: unknown Conversion failed!
I also tried:
ffmpeg -i 1.rmvb -c copy 1.avi
ffmpeg version N-86447-gfeb13ae Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.1.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --e
nable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --
enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-li
bfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug -
-enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enabl
e-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li
bsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolam
e --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable
-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 63.100 / 55. 63.100
libavcodec 57. 98.100 / 57. 98.100
libavformat 57. 73.100 / 57. 73.100
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 92.100 / 6. 92.100
libswscale 4. 7.101 / 4. 7.101
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
[rm # 00077520] Invalid stream index 2 for index at pos 206099254
Input #0, rm, from '1.rmvb':
Metadata:
title : ArabSeed.CoM
author : ArabSeed.CoM
copyright : ArabSeed.CoM
comment :
ASMRuleBook : #($Bandwidth >= 0),Stream0Bandwidth = 64082, Stream1Bandwi
dth = 285918;
Audiences : Easy RealMedia Tool's Audience;
audioMode : music
Creation Date : 4/22/2010 4:31:14
Description : This File is Created by Easy RealMedia Tools#!
Email : rick#redcheek.net
Generated By : Easy RealMedia Tools V1.8x
HomeWeb : http://redcheek.net
Keywords : ArabSeed.CoM
Modification Date: 4/22/2010 4:31:14
videoMode : normal
Duration: 01:16:35.69, start: 0.000000, bitrate: 358 kb/s
Stream #0:0: Audio: cook (cook / 0x6B6F6F63), 44100 Hz, stereo, fltp, 64 kb/
s
Stream #0:1: Video: rv40 (RV40 / 0x30345652), yuv420p, 720x408, 280 kb/s, 25
fps, 25 tbr, 1k tbn, 1k tbc
Could not write header for output file #0 (incorrect codec parameters ?): Operat
ion not permitted
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:0 -> #0:1 (copy)
Last message repeated 1 times
Don't have a rv40 stream to test with, but you should be able to mux into MKV, AVI, and RM.
ffmpeg -i 1.rmvb -c copy 1.mkv
ffmpeg -i 1.rmvb -c copy 1.rm
ffmpeg -i 1.rmvb -c copy 1.avi
I am trying to encode a video with FFMPEG x265, put it into MPEG2 TS and then stream it over UDP. Then receive on another PC and save it. Perform PSNR.
The encoding works fine, but when I try to stream I get the error:
[mpegts # 00000000050b0520] HEVC bitstream error, startcode missing, size 1436 data 00000100
Step 1- Encoding:
ffmpeg -re -i test.ts -r 25 -b:v 2500k -preset medium -c:v libx265 -x265-params crf=27 -y -f mpegts test1.ts
No error, everything fine.
Step 2- Streaming:
Start code missing.
ffmpeg -re -i test1.ts -c copy -f mpegts udp://172.18.60.47:1234
ffmpeg version N-68441-g4fa42e0 Copyright (c) 2000-2014 the FFmpeg developers
built on Dec 14 2014 22:13:03 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnut
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --e
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsc
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zl
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 14.100 / 56. 14.100
libavformat 56. 15.105 / 56. 15.105
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 3.101 / 5. 3.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mpegts, from 'test1.ts':
Duration: 00:00:10.12, start: 1.480000, bitrate: 456 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: hevc (Main) ([36][0][0][0] / 0x0024), yuv420p(tv), 1280x720, 25 fps, 25 tbr, 90k tbn, 25 tbc
Output #0, mpegts, to 'udp://172.18.60.47:1234':
Metadata:
encoder : Lavf56.15.105
Stream #0:0: Video: hevc ([36][0][0][0] / 0x0024), yuv420p, 1280x720, q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
**[mpegts # 0000000004ed7320] HEVC bitstream error, startcode missing, size 2462 data 00000102**
[mpegts # 0000000004ed7320] HEVC bitstream error, startcode missing, size 302 data 00000102
[mpegts # 0000000004ed7320] HEVC bitstream error, startcode missing, size 134 data 00000100
[mpegts # 0000000004ed7320] HEVC bitstream error, startcode missing, size 149 data 00000100
[mpegts # 0000000004ed7320] HEVC bitstream error, startcode missing, size 5107 data 00000102
[mpegts # 0000000004ed7320] HEVC bitstream error, startcode missing, size 1331 data 00000102
[mpegts # 0000000004ed7320] HEVC bitstream error, startcode missing, size 341 data 00000100
frame= 8 fps=0.0 q=-1.0 Lsize= 37kB time=00:00:00.24 bitrate=1278.4kbits/s
video:34kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.718209%
Received signal 2: terminating.
When I do the steps above with x264 everything works fine. I can stream the video and I can receive it on the other side. Any idea what is wrong? Is this a BUG?
Commands for x264:
ffmpeg -re -i test.ts -r 25 -b:v 2500k -preset medium -c:v libx264 -x264-params crf=27 -y -f mpegts test1.ts
ffmpeg -re -i test1.ts -c copy -f mpegts udp://172.18.60.47:1234
Thanks for the help!!
BR,
Rudi
I'm trying to use ffmpeg to cut out part of an avi file.
I know similar questions have been asked before, but i've trawled through loads of other posts and I can't see where I'm going wrong.
The command line args i'm using to test on a 7 second video is:
-ss 00:00:01 -t 00:00:01 -i "C:\recordings\2013-09-11\Camera 1\Camera 1_2013-09-11_22-23-43.avi" -vcodec copy -acodec copy "I:\clip2.avi"
The output is:
ffmpeg version N-56254-gb7bd688 Copyright (c) 2000-2013 the FFmpeg developers built on Sep 12 2013 21:00:14 with gcc 4.7.3 (GCC) configuration:
--enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 43.100 / 52. 43.100
libavcodec 55. 31.101 / 55. 31.101
libavformat 55. 16.102 / 55. 16.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 84.100 / 3. 84.100
libswscale 2. 5.100 / 2. 5.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, avi, from 'C:\recordings\2013-09-11\Camera 1\Camera 1_2013-09-11_22-23-43.avi':
Duration: 00:00:07.03, start: 0.000000, bitrate: 787 kb/s
Stream #0:0: Video: msmpeg4v3 (DIV3 / 0x33564944), yuv420p, 800x448, 30 fps, 30 tbr, 30 tbn, 30 tbc
Stream #0:1: Audio: adpcm_ms ([2][0][0][0] / 0x0002), 44100 Hz, mono, s16, 176 kb/s
Output #0, avi, to 'I:\clip2.avi':
Metadata:
ISFT : Lavf55.16.102
Stream #0:0: Video: msmpeg4v3 (DIV3 / 0x33564944), yuv420p, 800x448, q=2-31, 30 fps, 30 tbn, 30 tbc
Stream #0:1: Audio: adpcm_ms ([2][0][0][0] / 0x0002), 44100 Hz, mono, 176 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 88 fps=0.0 q=-1.0 Lsize= 226kB time=00:00:02.03 bitrate= 908.7kbits/s
video:146kB audio:66kB subtitle:0 global headers:0kB muxing overhead 6.345259%
I end up with a clip which is 3 seconds long !!!??
In the output I can see that the -ss flag is completely ignored.
Can anyone see where I'm going wrong?
Thanks
Some tips here: https://trac.ffmpeg.org/wiki/Seeking%20with%20FFmpeg
See "Fast Seeking" vs "Accurate Seeking". For accurate seeking:
-ss must come AFTER -i
I suspect your input frames fall outside any keyframes so "Fast Seeking" (-ss before -i) fails.
Also -t normally takes as its input a number of frames, I'm not sure if it accepts a timecode. Consider using -t 1 instead or -to 00:00:02 instead (note: -to, not -t).
EDIT: slhck is right regarding -t versus -vframes, see comment.
-i is for duration.
for example if you want 5 seconds video, Should write
-ss 00:00:01 -t 00:00:05 -i "C:\recordings\2013-09-11\Camera 1\Camera 1_2013-09-11_22-23-43.avi" -vcodec copy -acodec copy "I:\clip2.avi"
-ss is the offset when you write -ss 00:00:01 that Leaves to you 6 seconds
when write -t 00:00:01 that's make a video with 1 second not 3 seconds.
Just don't use codec copy command. delete "-vcodec copy -acodec copy" and try you are will get exact copy times
The question is simple: I don't want ffmpeg to create an animated GIF from given video stream, I want separate frames, each in GIF format. But when I set output file to something like frame%09d.gif ffmpeg tends to create an animation (and stores it exactly as frame%09d.gif). The same for -f gif option.
Of course, I could save PNGs and use ImageMagic's convert utility to transform them to GIFs, but I don't want any additional invocation overhead because I'm dealing with live streams and going to crunch large amounts of data.
Here is what I do, nothing special:
ffmpeg -i http://brightcove03-f.akamaihd.net/valgbodmandag1378107345_1_300k#80362 -f gif -y frame_%09d.gif
ffmpeg version N-54643-g15cee5e Copyright (c) 2000-2013 the FFmpeg developers
built on Jul 11 2013 03:35:11 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnu
tls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --ena
ble-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger -
-enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-lib
vpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 39.100 / 52. 39.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.101 / 55. 12.101
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 80.100 / 3. 80.100
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
[flv # 00000000002cb700] Stream discovered after head already parsed
Input #0, flv, from 'http://brightcove03-f.akamaihd.net/valgbodmandag1378107345_1_300k#80362':
Metadata:
encoder : Lavf54.6.100
Duration: 00:00:00.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 480x270 [SAR 1:1 DAR 16:9], 25 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s
Stream #0:2: Data: none
[swscaler # 0000000004d051e0] No accelerated colorspace conversion found from yuv420p to bgr8.
Output #0, gif, to 'frame_%09d.gif':
Metadata:
encoder : Lavf55.12.101
Stream #0:0: Video: gif, bgr8, 480x270 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 100 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> gif)
Press [q] to stop, [?] for help
frame= 141 fps=130 q=-1.0 Lsize= 4960kB time=00:00:05.68 bitrate=7153.1kbits/s
video:5100kB audio:0kB subtitle:0 global headers:0kB muxing overhead -2.743247%
After all I get a file named "frame_%03d.gif", but instead I want to have several files "frame_001.gif", "frame_002.gif", etc.
Any ideas?
Thanks in advance.
When you use -f gif, you're forcing ffmpeg to use the GIF muxer, which writes the converted video stream into a single animated GIF file.
With recent ffmpeg:
Use this to force ffmpeg to mux every frame as a GIF to a separate file:
ffmpeg -i input -c:v gif -f image2 out%04d.gif
With ffmpeg 1.2.1 and lower:
When you leave out -f gif, ffmpeg correctly produces single images for each frame:
ffmpeg -i input output%04d.gif
If you're stuck on a version where you still have this bug (i.e. probably 2.0 and 2.1), ffmpeg doesn't follow the above syntax. Your only option here is to create PNG images instead:
ffmpeg -i input output%04d.png
And use ImageMagick to convert them:
for f in output*.png; do convert "$f" "${f%.png}.gif"; done