I'm trying to make a stream using a webcam as data input with FFmpeg, but I need to stream a video in addition to the stream. Both features with the same command for a few minutes.
(If placed separately the recording code works perfectly)
FFmpeg code:
ffmpeg -f dshow -i video="Integrated Webcam" -t 300 -c:v libx264 -segment_atclocktime 1 -segment_format mp4 '/meu_video.mp4' | -s 640x360 -ac 2 -f flv -vcodec libx264 -profile:v baseline -maxrate 600000 -bufsize 600000 -r 25 -ar 44100 -c:a libfaac -b:a 128k "http://localhost:3030"
There are two errors, one when I try to join the two codes using | or \ and the other when I put only the stream code to test.
Log multiple outputs:
ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.1.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-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-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --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. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, dshow, from 'video=Integrated Webcam':
Duration: N/A, start:
264374.193000, bitrate: N/A
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
http://localhost:3030/: Unknown error
Edit 3: I ran the command using -report and generated the report, but it's too big to paste into the question.
https://www.dropbox.com/s/2xsuzq5fx464o4w/ffmpeg-20171109-145406.log?dl=0
You don't need a separator.
ffmpeg -f dshow -rtbufsize 32M -i video="Integrated Webcam" -t 300 -c:v libx264 -segment_atclocktime 1
-segment_format mp4 '/meu_video_%d.mp4' -s 640x360 -f flv
-vcodec libx264 -profile:v baseline -maxrate 600000 -bufsize 600000 -r 25 "http://localhost:3030"
(I haven't removed the audio options although you don't have any audio inputs).
Related
What's the command to convert an MP4 to the output format similar to a video with this ffprobe:
ffprobe version N-82151-g1e660fe Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --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-decklink --enable-zlib
libavutil 55. 35.100 / 55. 35.100
libavcodec 57. 65.100 / 57. 65.100
libavformat 57. 57.100 / 57. 57.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 66.100 / 6. 66.100
libswscale 4. 3.100 / 4. 3.100
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, avi, from '.\sample.mp4.hd.mojo':
Metadata:
encoder : Lavf57.57.100
Duration: 00:37:28.85, start: 0.000000, bitrate: 10461 kb/s
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 960x540 [SAR 1:1 DAR 16:9], 9745 kb/s, 20 fps, 20 tbr, 20 tbn, 20 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 2 channels, s16, 705 kb/s
I've tried
ffmpeg -i "input.mp4" -c:v mjpeg -c:a pcm_s16le -an output.mp4
The output however does not play with the custom player.
Update:
I found a file which seemed to contain some config:
[high]
label=High quality
labelHelp=Converts to high quality
outSuffix=hd
codecParam=-vcodec mjpeg -vf scale=min'(960,iw)':-1 -acodec pcm_s16le -ar 22050 -ac 2 -r 20 -q:v 2
[medium]
label=Medium quality
labelHelp=Converts to medium quality
outSuffix=mid
codecParam=-vcodec mjpeg -vf scale=min'(960,iw)':-1 -acodec pcm_s16le -ar 22050 -ac 2 -r 20 -q:v 5
[low]
label=Low quality
labelHelp=Converts to low quality
outSuffix=low
codecParam=-vcodec mjpeg -vf scale=min'(960,iw)':-1 -acodec pcm_s16le -ar 22050 -ac 2 -r 20 -q:v 8
[main]
label=Convert to NComputing MOJO
labelHelp=Transcodes original file format to the NComputing MOJO format
outSuffix=
codecParam=
Finally I made it to work.
So to make a MOJO video file for NComputing devices here's the ffmpeg command:
ffmpeg -i "input.mp4" -vcodec mjpeg -vf scale=min'(960,iw)':-1 -acodec pcm_s16le -ar 22050 -ac 2 -r 20 -q:v 8 -f avi output.mojo
For low quality video. For other video quality just refer to the mojo.col file.
I'm new to encoding and I like to do my encodings in x265 10bit. Currently, I'm facing a little issue with ffmpeg. I noticed when I'm using libx265 encoder output file looks a little bit blurred or small detail loss. Code I used to do my encodes is
ffmpeg -i input.mp4 -c:v libx265 -preset medium -crf 22 -pix_fmt yuv420p10le -c:a copy -y output-x26510bit.mkv
I've found out psycho-visual options might help in this case. I modified my code in to
ffmpeg -i input.mp4 -c:v libx265 -preset medium -crf 22 -pix_fmt yuv420p10le -psy-rd 2 -psy-rdoq 4 --rdoq-level 1 -c:a copy -y output-x26510bit.mkv
When I issue the above command, I get an error code
C:\Users\abc\Desktop\1>ffmpeg -i input.mp4 -c:v libx265 -preset medium -crf 22 -pix_fmt yuv420p10le -psy-rd 2 -psy-rdoq
4 -rdoq-level 1 -c:a copy -y output-x26510bit.mkv
ffmpeg version git-2020-04-03-52523b6 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200328
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enabl
e-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enabl
e-libsrt --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-l
ibvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom
--enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --en
able-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.102 / 56. 42.102
libavcodec 58. 77.101 / 58. 77.101
libavformat 58. 42.100 / 58. 42.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.101 / 7. 77.101
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Unrecognized option 'psy-rdoq'.
Error splitting the argument list: Option not found
How do I solve this issue
These are not valid standalone options for libx265 in ffmpeg. You can see what private options are supported with ffmpeg -h encoder=libx265.
If you want to use additional options you have to use them with the -x265-params option:
ffmpeg -y -i input.mp4 -c:v libx265 -preset medium -crf 22 -pix_fmt yuv420p10le -x265-params psy-rd=2:psy-rdoq=4:rdoq-level=1 -c:a copy output-x26510bit.mkv
The result of my bellow FFmpeg command has no audio (is silent):
ffmpeg -f gdigrab -framerate 30 -i desktop -video_size 720x480 -c:v libvpx-vp9 -c:a libopus -b:v 1M -b:a 128K -auto-alt-ref 0 -crf 10 -preset ultrafast output.webm
But this one has audio:
ffmpeg -f gdigrab -i desktop -f dshow -i audio="Microphone (4- High Definition Audio Device)" output.mkv
How should I capture as webm file by using libopus or libvorbis?
What is the problem in my first command?
My FFmpeg version:
ffmpeg version N-93439-gb073fb9eea Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20190212
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --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-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 47.105 / 58. 47.105
libavformat 58. 26.101 / 58. 26.101
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Issues are best troubleshooted by changing one variable at a time. Your 2nd command has two changes - an audio input and a different container profile (webm -> mkv).
gdigrab is a video grabber, so no audio is supplied. You need to feed an audio input.
ffmpeg -f gdigrab -framerate 30 -video_size 720x480 -i desktop -f dshow -i audio="Microphone (4- High Definition Audio Device)" -c:v libvpx-vp9 -b:v 1M -crf 10 -auto-alt-ref 0 -c:a libopus -b:a 128K output.webm
I have a working setup for streaming a video to youtube with my raspberry pi 3.
It was work until yesterday. Nothing changed but I have an error when I try to start the stream.
Running the following command:
raspivid -o - -t 0 -w 1280 -h 720 -p -hf -fps 25 -b 2560000 | avconv -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/my_key
And get this error:
ffmpeg version 3.2.10-1~deb9u1+rpt1 Copyright (c) 2000-2018 the FFmpeg
developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516
configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1'
--toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --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-libxvid --enable-libzmq --enable-libzvbi --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 /
57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 /
54. 1.100 Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, s16le, from '/dev/zero': Duration: N/A, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s Input #1, h264, from 'pipe:': Duration: N/A, bitrate: N/A
Stream #1:0: Video: h264 (High), yuv420p(progressive), 1280x720, 25 fps, 25 tbr, 1200k tbn, 50 tbc
rtmp://a.rtmp.youtube.com/live2/my_key: Input/output error
It worked more over a month, but now (I don't know why) stopped working.
Can anyone help me?
Cheers,
Greg
I figured it out!
If you have the same problem just go to youtube stream now / encoder setup / stream name/key, push the reveal button and then the reset button to get a new stream name/key string.
Use the new key!
I have this ffmpeg command that I use to create a video from a photo and a animated GIF border overlay, and a audio track.
ffmpeg -framerate 15 -loop 1 -i photo.jpg -ignore_loop 0 -i overlay.gif -filter_complex "scale=(iw*sar)*max(600/(iw*sar)\,750/ih):ih*max(600/(iw*sar)\,750/ih), crop=600:750, overlay" -i audio.wav -c:v libx264 -c:a aac -b:a 192k -shortest output.mp4
What I want is to lower the opacity of the overlay image.
I have checked a lot of threads, but I can't figure out how to combine something like this with my existing filters.
-filter_complex "blend=all_mode='overlay':all_opacity=0.7"
Any ideas?
Here's the full ffmpeg output of one of my tests:
ffmpeg -framerate 15 -loop 1 -i photo.jpg -ignore_loop 0 -i overlay.gif -filter_complex "scale=(iw*sar)*max(600/(iw*sar)\,750/ih):ih*max(600/(iw*sar)\,750/ih), crop=600:750, blend=all_mode='overlay':all_opacity=0.7" -i audio.wav -c:v libx264 -c:a aac -b:a 192k -shortest output.mp4
ffmpeg version N-83507-g8fa18e0 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enabl
e-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug -
-enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspe
ex --enable-libtheora --enable-libtwolame --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. 47.100 / 55. 47.100
libavcodec 57. 80.100 / 57. 80.100
libavformat 57. 66.102 / 57. 66.102
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 73.100 / 6. 73.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, image2, from 'photo.jpg':
Duration: 00:00:00.07, start: 0.000000, bitrate: 15374 kb/s
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 400x600 [SAR 72:72 DAR 2:3], 15 fps, 15 tbr, 15 tbn, 15 tbc
Input #1, gif, from 'overlay.gif':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: gif, bgra, 600x750, 5.42 fps, 5 tbr, 100 tbn, 100 tbc
Guessed Channel Layout for Input Stream #2.0 : mono
Input #2, wav, from 'audio.wav':
Duration: 00:00:23.00, bitrate: 705 kb/s
Stream #2:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
[swscaler # 00000000023300a0] deprecated pixel format used, make sure you did set range correctly
[swscaler # 000000000234d1e0] deprecated pixel format used, make sure you did set range correctly
[Parsed_blend_2 # 00000000022fd0c0] First input link top parameters (size 600x750, SAR 1:1) do not match the corresponding second input link bottom parameters (600x750, SAR 0:1)
[Parsed_blend_2 # 00000000022fd0c0] Failed to configure output pad on Parsed_blend_2
Error configuring complex filters.
Invalid argument
Use the colorchannelmixer filter.
ffmpeg -framerate 15 -loop 1 -i photo.jpg
-ignore_loop 0 -i overlay.gif
-i audio.wav
-filter_complex "[0]scale=(iw*sar)*max(600/(iw*sar)\,750/ih):ih*max(600/(iw*sar)\,750/ih),
crop=600:750[b];
[1]format=argb,colorchannelmixer=aa=0.5[ol];[b][ol]overlay"
-c:v libx264 -c:a aac -b:a 192k -shortest output.mp4
The 0.5 sets it to 50% transparent.