ffmpeg for windows: error when concatenating videos - ffmpeg

i have extracted a few clips from a video file of resolution 1920x816 called ca0.mp4...ca9.mp4 using the command
ffmpeg -i ./ca.mkv -ss 00:53:24 -t 00:01:30 ca0.mp4
Then i created a black video using
ffmpeg -f lavfi -i color=black:s=1920x816:r=24000/1001 -f lavfi -i anullsrc -ar 48000 -ac 2 -t 00:00:02 empty.mp4
now i want to concencate the clips with the black video between them. Therefore i created a file list.txt:
file 'ca0.mp4'
file 'empty.mp4'
file 'ca1.mp4'
file 'empty.mp4'
file 'ca2.mp4'
file 'empty.mp4'
file 'ca3.mp4'
file 'empty.mp4'
file 'ca4.mp4'
file 'empty.mp4'
file 'ca5.mp4'
file 'empty.mp4'
file 'ca6.mp4'
file 'empty.mp4'
file 'ca7.mp4'
file 'empty.mp4'
file 'ca8.mp4'
file 'empty.mp4'
file 'ca9.mp4'
and tried the command
ffmpeg -f concat -i list.txt -c:v qtrle -c:a copy ca.mp4
however, i get the following output:
ffmpeg version N-89940-gb1af0e23a3 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
libavutil 56. 7.100 / 56. 7.100
libavcodec 58. 9.100 / 58. 9.100
libavformat 58. 7.100 / 58. 7.100
libavdevice 58. 0.101 / 58. 0.101
libavfilter 7. 11.101 / 7. 11.101
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
[mov,mp4,m4a,3gp,3g2,mj2 # 000001e2cd155900] Auto-inserting h264_mp4toannexb bitstream filter
Guessed Channel Layout for Input Stream #0.1 : 5.1
Input #0, concat, from 'list.txt':
Duration: N/A, start: -0.021333, bitrate: 1894 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x816 [SAR 1:1 DAR 40:17], 1500 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(ger): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 394 kb/s
Metadata:
handler_name : SoundHandler
Stream #0:2(eng): Data: bin_data (text / 0x74786574), 0 kb/s
Metadata:
handler_name : SubtitleHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> qtrle (native))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 # 000001e2cd213080] Could not find tag for codec qtrle in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
Conversion failed!
can anyone tell me, what i did wrong?

As all files are already converted in .mp4 from .mkv
you may just need to copy the video codec too
ffmpeg -f concat -i list.txt -c:v copy -c:a copy ca.mp4
It will also speed up the process

Related

ffmpeg H.264 Two-Pass runs fine on Windows but error on Linux (Error while opening encoder for output stream #0:0)

the command I use to encode:
ffmpeg -y -i VideoCapture.mp4 -c:v libx264 -b:v 444k -pass 1 -an -f null /dev/null && \
ffmpeg -i VideoCapture.mp4 -c:v libx264 -b:v 444k -pass 2 -c:a aac -b:a 128k output.mp4
I took this code from the official ffmpeg documentation, by changing the audio and video bitrate values according to the examples in the documentation. This code error when I run it on Linux.
The above code can run on windows (by changing the characters "NULL" and "").
This is the full output of the error:
ffmpeg version N-59498-g45dc668aea-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 57. 7.100 / 57. 7.100
libavcodec 59. 12.100 / 59. 12.100
libavformat 59. 8.100 / 59. 8.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 16.101 / 8. 16.101
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VideoCapture.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1
creation_time : 2021-07-02T07:26:53.000000Z
Duration: 00:23:50.31, start: 0.000000, bitrate: 803 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 736 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
Metadata:
creation_time : 2021-07-02T07:26:53.000000Z
vendor_id : [0][0][0][0]
Stream #0:1[0x2](und): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 63 kb/s (default)
Metadata:
creation_time : 2021-07-02T07:09:01.000000Z
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 # 0x75dea80] using SAR=1/1
[libx264 # 0x75dea80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
Why this happened? is there any solution for this problem?
thank you.

.avi file to .webm file with alpha channel

I have no idea how to use FFmpeg, but my .avi file is too large for a 2-second video? Any idea how I can convert it to WebM? While retaining its alpha channel?
I tried this:
ffmpeg -i "1.avi" -c:v libvpx -pix_fmt yuva420p "1.webm"
Output showed:
ffmpeg version 4.4-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[avi # 00000245f2e7d640] Stream #0: not enough frames to estimate rate; consider increasing probesize
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from '1.avi':
Duration: 00:00:02.00, start: 0.000000, bitrate: 3983150 kb/s
Stream #0:0: Video: rawvideo, bgra, 1920x1080, 4014784 kb/s, 60 fps, 60 tbr, 60 tbn, 60 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> vp8 (libvpx))
Stream #0:1 -> #0:1 (pcm_s16le (native) -> opus (libopus))
Press [q] to stop, [?] for help
[libvpx # 00000245f2e8ecc0] v1.10.0-24-g8b3e575a4
[libvpx # 00000245f2e8ecc0] Neither bitrate nor constrained quality specified, using default CRF of 32 and bitrate of 256kbit/sec
[libvpx # 00000245f2e8ecc0] Transparency encoding with auto_alt_ref does not work
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
Simplest command is:
ffmpeg -i input.avi output.webm
The video encoder libvpx-vp9 will be used by default.
libvpx-vp9 supports alpha, so alpha will be preserved by default.
For more info see FFmpeg Wiki: VP9.
Command I used to solve:
ffmpeg -i "1.avi" -c:v libvpx -b:v 2000k -pix_fmt yuva420p -auto-alt-ref 0 "1.webm"
"1.avi" - input.avi
"1.webm" - out.webm
Simple command:
ffmpeg -i input.avi output.webm

How to generate m3u8 file and list of TS segment files using ffmpeg for wmv and avi video files

I am able to generate m3u8 and list of segment(.ts) files from mp4 video file using following ffmpeg command
ffmpeg -i Bee_Free.mp4 -codec copy -vbsf h264_mp4toannexb -map 0 -f segment -segment_list free.m3u8 -segment_time 10 free%03d.ts
I am using the same command to generate m3u8 and ts files from .wmv and .avi files
command for .avi file
ffmpeg -i PalivalaBadraVatakam.avi -codec copy -vbsf h264_mp4toannexb -map 0 -f segment -segment_list palivaala.m3u8 -segment_time 10 palivaala%03d.ts
Error
ffmpeg version N-89041-g91a565e20f Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-
libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-
libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-
libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
libavutil 56. 0.100 / 56. 0.100
libavcodec 58. 3.101 / 58. 3.101
libavformat 58. 2.100 / 58. 2.100
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 0.101 / 7. 0.101
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from 'PalivalaBadraVatakam.avi':
Metadata:
date : 2018-04-24T17:08:40+05:30
encoder : Adobe Premiere Pro CC 2018.1 (Windows)
Duration: 00:00:53.19, start: 0.000000, bitrate: 30317 kb/s
Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv411p, 720x480 [SAR 8:9 DAR 4:3], 28789 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
[AVBSFContext # 000001e976f84080] Codec 'dvvideo' (24) is not supported by the bitstream filter 'h264_mp4toannexb'. Supported codecs are: h264 (27)
Error initializing bitstream filter: h264_mp4toannexb
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Last message repeated 1 times
Command for .wmv file
ffmpeg -i Palivaalaa.wmv -codec copy -vbsf h264_mp4toannexb -map 0 -f segment -segment_list palivaalaa.m3u8 -segment_time 10 palivaalaa%03d.ts
Error
ffmpeg version N-89041-g91a565e20f Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-
libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-
libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-
libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
libavutil 56. 0.100 / 56. 0.100
libavcodec 58. 3.101 / 58. 3.101
libavformat 58. 2.100 / 58. 2.100
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 0.101 / 7. 0.101
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
[wmv3 # 0000024020a04a40] Extra data: 8 bits left, value: 20
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, asf, from 'Palivaalaa.wmv':
Metadata:
Application : Windows Movie Maker 2.6.4037.0
WMFSDKVersion : 12.0.16299.248
WMFSDKNeeded : 0.0.0.0000
artist : Sathish
IsVBR : 0
DeviceConformanceTemplate: MP#ML
Duration: 00:01:00.10, start: 0.000000, bitrate: 571 kb/s
Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, stereo, fltp, 96 kb/s
Stream #0:1(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 640x480, 768 kb/s, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 1k tbn, 1k tbc
[AVBSFContext # 0000024020a9b420] Codec 'wmv3' (71) is not supported by the bitstream filter 'h264_mp4toannexb'. Supported codecs are: h264 (27)
Error initializing bitstream filter: h264_mp4toannexb
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Last message repeated 1 times
HLS with TS files only supports h.264 video codec and aac or mp3 audio. Hence -codec copy will not work. Just remove that, and ffmpeg should choose libx264 automatically.
This file formats support by the TS muxer are listed here https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/mpegts.h#L45-L64
In summary they are:
VIDEO_MPEG1
VIDEO_MPEG2
AUDIO_MPEG1
AUDIO_MPEG2
AUDIO_AAC
AAC_LATM
VIDEO_MPEG4
METADATA
VIDEO_H264
VIDEO_HEVC
VIDEO_CAVS
VIDEO_VC1
VIDEO_DIRAC
AUDIO_AC3
AUDIO_DTS
AUDIO_TRUEHD
AUDIO_EAC3
None of the codecs you are trying are listed. And as it has in it's name the -vbsf h264_mp4toannexb and the error message Codec 'wmv3' (71) is not supported by the bitstream filter 'h264_mp4toannexb'. Supported codecs are: h264 (27), the h264_mp4toannexb filter only supports h264

Can ffmpeg copy parts from an rmvb file without re-encoding?

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

linux ffmpeg get rtmp stream and convert into a live webcam v4l2

So I simply try out to get the stream and convert it into a rawvideo and create a new webcam with v4l2.
ffmpeg -i "rtmp://XX.XX.XXX.XXX/XXXXXXXXXXXX/test" -vcodec rawvideo -y -f v4l2 /dev/video2
It is working a long time and then I got this:
ffmpeg version 2.7.1 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-shared --enable-version3 --enable-x11grab
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, flv, from 'rtmp://XX.XX.XXX.XXX/XXXXXXXXXXXX/test':
Metadata:
fileSize : 0
audiochannels : 2
encoder : obs-output module (libobs version 0.10.1-67-g94edb7f)
Duration: 00:00:00.00, start: 1774.608000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(tv, bt709), 1920x1080, 2560 kb/s, 30.30 fps, 30 tbr, 1k tbn, 60 tbc
Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 196 kb/s
[v4l2 # 0x7f7326cb4480] Unable to open V4L2 device '/dev/video2'
Output #0, v4l2, to '/dev/video2':
Metadata:
fileSize : 0
audiochannels : 2
encoder : Lavf56.36.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc
Metadata:
encoder : Lavc56.41.100 rawvideo
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory
To create virtual video devices you need to install and enable v4l2loopback. The "No such file or directory" message means you didn't enable the device.
sudo modprobe v4l2loopback video_nr=2
This will create the /dev/video2 device.
Update: in response to umläute's comment make sure the v4l2loopback module is persistent, just in case your server reboots. Uptime can be very long.
Example for CentOS: Persistent Module Loading

Resources