Volume adjust and channel merge on video using FFMPEG - audio

I'm trying to convert a recorded AVI (1 video stream, 2 audio streams[1st is stereo, 2nd is mono]) video file to H264/AAC.
I want the second audio stream to be at 60% volume and the first at 100%.
I also want to merge the first and second audio stream.
Output should be H264 with AAC audio.
The command I tried to use is:
"ffmpeg.exe"
-i "input.avi"
-filter_complex "
[0:a:0]aformat=channel_layouts=stereo,volume=1.0[a1];
[0:a:1]aformat=channel_layouts=mono,volume=0.6[a2];
[a1][a2]amerge,pan=stereo|c0<c0+c2|c1<c1+c2[out]
"
-map 0:v
-map "[out]"
-c:v libx264 -preset slow -crf 26
-c:a aac -strict experimental -ab 128000 -ac 2 -ar 48000
"output.mp4"
But I get the error:
[AVFilterGraph # 0000000ceb630c00] The following filters could not choose their formats: Parsed_amerge_4
Consider inserting the (a)format filter near their input or output.
Error configuring complex filters.
Error number -5 occurred
What am I doing wrong and how can it be fixed?
Complete Console Log:
ffmpeg version N-76456-g6df2c94 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (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-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --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-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 5.100 / 55. 5.100
libavcodec 57. 14.100 / 57. 14.100
libavformat 57. 14.100 / 57. 14.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 14.101 / 6. 14.101
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
[avi # 000000b1cfa6bc20] non-interleaved AVI
Guessed Channel Layout for Input Stream #0.1 : stereo
Guessed Channel Layout for Input Stream #0.2 : mono
Input #0, avi, from 'input.avi':
Metadata:
encoder : DxtoryCore ver2.0.0.122
ISRC : Video:Lagarith Lossless Codec Audio0:Lautsprecher (2- USB Audio CODEC ) Audio1:Mikrofon (2- USB Audio CODEC )
Duration: 00:27:55.60, start: 0.000000, bitrate: 181780 kb/s
Stream #0:0: Video: lagarith (LAGS / 0x5347414C), rgb24, 1920x1017, 179663 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Stream #0:2: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 1 channels, s16, 705 kb/s
[Parsed_amerge_4 # 000000b1cfaf3200] No channel layout for input 1
Last message repeated 1 times
[AVFilterGraph # 000000b1cfa70c00] The following filters could not choose their formats: Parsed_amerge_4
Consider inserting the (a)format filter near their input or output.
Error configuring complex filters.
Error number -5 occurred

It seems this can be fixed by splitting all audio streams into separate channels first and then feeding it back into the amerge filter.
"ffmpeg.exe"
-i "input.avi"
-filter_complex "
[0:a:0]volume=1.0,channelsplit=channel_layout=stereo[a1][a2];
[0:a:1]volume=0.6,channelsplit=channel_layout=mono[a3];
[a1][a2][a3]amerge=inputs=3,pan=stereo|c0<c0+c2|c1<c1+c2[out]
"
-map 0:v
-map "[out]"
-c:v libx264 -preset slow -crf 26
-c:a aac -strict experimental -ab 128000 -ac 2 -ar 48000
"output.mp4"

Related

FFmpeg 5: How to add cover art to m4a file

I've tried
ffmpeg -i input.m4a -i image.jpg -map 0 -map 1 -c copy -disposition:v:1 attached_pic output.m4a
from this answer FFmpeg, how to embed cover art (image) to .m4a
but that does not seem to work correctly, giving me output as below:
ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.0.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/username/Desktop/output.m4a':
Metadata:
major_brand : M4A
minor_version : 512
compatible_brands: M4A isomiso2
encoder : Lavf59.16.100
Duration: 00:00:03.69, start: 0.000000, bitrate: 131 kb/s
Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Input #1, image2, from '/Users/username/Pictures/image.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 14753 kb/s
Stream #1:0: Video: mjpeg (Progressive), yuvj420p(pc, bt470bg/unknown/unknown), 947x960 [SAR 1:1 DAR 947:960], 25 fps, 25 tbr, 25 tbn
[ipod # 0x14df051e0] Could not find tag for codec mjpeg in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:1 --
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (copy)
Last message repeated 1 times

FFMPEG: Specifying Output Stream Type When Combing Multiple Filters

I currently have 3 separate ffmpeg commands that do the following:
Overlay a watermark on a video: ffmpeg -i samplegreen.webm -i foregrounds/myimage.png -r 30 -filter_complex "overlay=(W-w)/2:H-h" -af "adelay=700" output.mp4
Overlay the results of 1) onto a beach video: ffmpeg -i backgrounds/beachsunsetmp4.mp4 -i output.mp4 -filter_complex "[1:v]chromakey=0x005d0b:0.1485:0.03[ckout];[0:v][ckout]overlay[o]" -map [o] -map 1:a -shortest somefolder/sample_video.mp4
Merge the audio of the results of 2) with another audio file: ffmpeg -i somefolder/sample_video.mp4 -i backgrounds/beachsunsetmp4.mp3 -filter_complex '[0:a][1:a]amerge=inputs=2[a]' -map 0:v -map '[a]' -c:v copy -ac 2 -shortest anotherfolder/sample_video.mp4
Now, this all works as intended, however, I was looking into attempting to combine them all into a single command, combining all the filters, like so:
ffmpeg -i samplegreen.webm -i foregrounds/myimage.png -r 30 -i backgrounds/beachsunsetmp4.mp4 -i backgrounds/beachsunsetmp4.mp3 -filter_complex \
"[0]overlay=(W-w)/2:H-h[output_1]; \
[output_1]chromakey=0x005d0b:0.1485:0.03[ckout]; \
[2:v][ckout]overlay[output_2]; \
[output_2][3:a] amerge=inputs=2 [output_3]" \
-af "adelay=700" -map [output_3] shortest final.mp4
It fails with the following error (Media type mismatch between the 'Parsed_overlay_2' filter output pad 0 (video) and the 'Parsed_amerge_3' filter input pad 0 (audio)):
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.2_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, matroska,webm, from 'samplegreen.webm':
Metadata:
encoder : Chrome
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0(eng): Video: vp8, yuv420p(progressive), 1280x720, SAR 1:1 DAR 16:9, 1k tbr, 1k tbn, 1k tbc (default)
Metadata:
alpha_mode : 1
Stream #0:1(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Input #1, png_pipe, from 'foregrounds/myimage.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgba(pc), 350x86, 25 tbr, 25 tbn, 25 tbc
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'backgrounds/beachsunsetmp4.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2021-02-16T18:24:40.000000Z
Duration: 00:00:32.53, start: 0.000000, bitrate: 3032 kb/s
Stream #2:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 3027 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2021-02-16T18:24:40.000000Z
handler_name : ?Mainconcept Video Media Handler
encoder : AVC Coding
[mp3 # 0x7f86cf809000] Estimating duration from bitrate, this may be inaccurate
Input #3, mp3, from 'backgrounds/beachsunsetmp4.mp3':
Metadata:
date : 2021-02-18 06:49
id3v2_priv.XMP : <?xpacket begin="\xef\xbb\xbf" id="W5M0MpCehiHzreSzNTczkc9d"?>\x0a<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 6.0-c003 79.164527, 2020/10/15-17:48:32 ">\x0a <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\x0a <rdf
Duration: 00:00:32.60, start: 0.000000, bitrate: 132 kb/s
Stream #3:0: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s
[Parsed_overlay_2 # 0x7f86cd4039c0] Media type mismatch between the 'Parsed_overlay_2' filter output pad 0 (video) and the 'Parsed_amerge_3' filter input pad 0 (audio)
[AVFilterGraph # 0x7f86cd402a40] Cannot create the link overlay:0 -> amerge:0
Error initializing complex filters.
Invalid argument
As far as I can tell, the issue is that the filter, amerge, wants 2 audio streams. Normally, I could take the input stream argument (which is a video), and make it use the audio by doing something like [0:a][1:a]amerge=inputs=2[results]. However, since my input stream is the output of a preceding filter, that doesn't seem to work (i.e. [output_2:a]). It bombs out with:
[matroska,webm # 0x7fecca000000] Invalid stream specifier: output_2:a.
Last message repeated 1 times
Stream specifier 'output_2:a' in filtergraph description [0]overlay=(W-w)/2:H-h[output_1]; [output_1]chromakey=0x005d0b:0.1485:0.03[ckout]; [2:v][ckout]overlay[output_2]; [output_2:a][3:a] amerge=inputs=2 [output_3] matches no streams.
So all of that said... Is there a way to specify that I'd like to use the audio stream from the output of a preceding filter? Or any other ways to combine all of these filters into a single command?
Thanks.
Any help would be greatly appreciated!
Except for a few filters like concat, a filter will take either only video inputs or only audio.
Here's the combined command.
ffmpeg \
-i samplegreen.webm \
-i foregrounds/myimage.png \
-i backgrounds/beachsunsetmp4.mp4 \
-i backgrounds/beachsunsetmp4.mp3 \
-filter_complex \
"[0][1]overlay=(W-w)/2:H-h,chromakey=0x005d0b:0.1485:0.03[ckout]; \
[2][ckout]overlay=shortest=1[v]; \
[0]adelay=700:all=1[0a]; \
[0a][3]amerge=inputs=2[a]" \
-map '[v]' -map '[a]' \
-shortest -r 30 -ac 2 \
output.mp4

Even after converting the Audio from Mono to Stereo in ffmpeg the video still has No sound Unless

I Change the audio Mode in VLC from Stereo to Mono then the Audio will play Normal
I used ffmpeg to convert the audio to Stereo using this
ffmpeg -i bokan_test_1.mkv -map 0 -map -0:s? -c:v copy -c:a ac3 -ac 2 -b:a 640k "E:\Test\output.S01E05.mkv"
I even used Handbrake still No audio in VLC unless I change the audio mode to Mono
Edit:
full log when running the ffmpeg command above
E:\test audio>ffmpeg -i bokan_test_1.mkv -map 0 -map -0:s? -c:v copy -c:a ac3 -ac 2 -b:a 640k "E:\Test\output.S01E06.mkv"
ffmpeg version 4.3.1-2021-01-01-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev5, 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. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, matroska,webm, from 'bokan_test_1.mkv':
Metadata:
encoder : libebml v1.3.0 + libmatroska v1.4.0
creation_time : 2015-07-27T22:38:36.000000Z
Duration: 00:20:01.02, start: 0.000000, bitrate: 3497 kb/s
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1440x1080, SAR 1:1 DAR 4:3, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
Stream #0:1(ara): Audio: aac (HE-AAC), 44100 Hz, stereo, fltp (default)
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (aac (native) -> ac3 (native))
Press [q] to stop, [?] for help
Output #0, matroska, to 'E:\Azmi\output.S01E06.mkv':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1440x1080 [SAR 1:1 DAR 4:3], q=2-31, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)
Stream #0:1(ara): Audio: ac3 ([0] [0][0] / 0x2000), 44100 Hz, stereo, fltp, 640 kb/s (default)
Metadata:
encoder : Lavc58.91.100 ac3
frame=35994 fps=5263 q=-1.0 Lsize= 595496kB time=00:20:01.03 bitrate=4061.8kbits/s speed= 176x
video:501161kB audio:93829kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.085007%

Can't synchronize frame from two webcam streams side by side using ffmpeg

i'm trying to stream two webcam in sbs mode using ffmpeg websocket.
It works but there is a delay of some second between the two scene.
Here is what I do :
ffmpeg -f v4l2 -framerate 30 -video_size 1280x720 -input_format mjpeg
-i /dev/video1 -f v4l2 -framerate 30 -input_format mjpeg
-video_size 1280x720 -i /dev/video0 -filter_complex "
[0:v][1:v]hstack [left+right]" -map [left+right] -r 30 -fflags nobuffer
-f mpegts -codec:v mpeg1video -s 2560x720 -b:v 800k -bf 0 http://localhost:8081/secretsecret
And this is the output:
ffmpeg version 4.1.3-0ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Ubuntu 8.3.0-6ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu1 --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-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, video4linux2,v4l2, from '/dev/video2':
Duration: N/A, start: 9539.835119, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 25 fps, 25 tbr, 1000k tbn, 1000k tbc
Input #1, video4linux2,v4l2, from '/dev/video4':
Duration: N/A, start: 9541.474622, bitrate: N/A
Stream #1:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 25 fps, 25 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 (mjpeg) -> hstack:input0
Stream #1:0 (mjpeg) -> hstack:input1
hstack -> Stream #0:0 (mpeg1video)
Press [q] to stop, [?] for help
[swscaler # 0x55aa2c266f00] deprecated pixel format used, make sure you did set range correctly
Output #0, mpegts, to 'http://localhost:8081/supersecret':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: mpeg1video, yuv420p, 2560x720, q=2-31, 800 kb/s, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
encoder : Lavc58.35.100 mpeg1video
Side data:
cpb: bitrate max/min/avg: 0/0/800000 buffer size: 0 vbv_delay: -1
[video4linux2,v4l2 # 0x55aa2c1d4e40] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
It works but there is a delay of ~1 second between the two screens.
also tried with:
ffmpeg -f v4l2 -framerate 25 -video_size 1280x720 -input_format mjpeg -i \
/dev/video2 -f v4l2 -framerate 25 -input_format mjpeg -video_size 1280x720 \
-i /dev/video4 -filter_complex " \
nullsrc=size=2560x720 [background]; \
[0:v] setpts=PTS-STARTPTS, scale=1280x720 [left]; \
[1:v] setpts=PTS-STARTPTS, scale=1280x720 [right]; \
[background][left] overlay=shortest=1 [background+left]; \
[background+left][right] overlay=shortest=1:x=1280 [left+right] \
" -map [left+right] -f mpegts -codec:v mpeg1video -s 2560x720 -b:v 800k -bf 0 http://localhost:8081/supersecret
but same problem....
How can I fix?

Make UDP-RTMP bridge with FFMPEG

I need to make this chain, using computer 2 as a "bridge" between Computer 1 and the streming server.
Computer 1 ----> Computer 2 ----> Streaming server (Wowza).
So I'm trying to set this:
Computer 1 --(via UDP)--> Computer 2 --(Via RTMP)--> Wowza
What I've tried:
1. At Computer 1
Entry:
ffmpeg -i sample.mp4 -c:v copy -c:a copy -f mpegts udp://192.168.0.109:5010
Result: Worked. Computer 1 sends the data correctly.
2. At Computer 2
Entry:
ffmpeg -i upd://192.168.0.109:5010 output.mp4
Result: Worked. Computer 2 gets data correctly. Output.mp4 is generated well.
Entry:
ffmpeg -i sample.mp4 -c:v copy -c:a copy -f flv rtmp://wowzaServerAddress
Result: Worked. Wowza shows online the video from sample.mp4
Entry:
ffmpeg -re -i udp://#:5010 -f flv rtmp://wowzaServerAddress
Result:
stuck at:
ffmpeg version N-77234-g906c0b7 Copyright (c) 2000-2015 the FFmpeg
built with gcc 5.2.0 (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-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --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-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 10.100 / 55. 10.100
libavcodec 57. 17.100 / 57. 17.100
libavformat 57. 20.100 / 57. 20.100
libavdevice 57.0.100 / 57. 0.100
libavfilter 6.21.100 / 6. 21.100
libswscale 4.0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
**Entry:**
ffmpeg -i udp://192.168.0.109:5010 -c:v copy -c:a copy -f flv rtmp://wowzaServerAddress
**Result:**
*... repeated a lot ...*
Last message repeated 1 times
[h264 # 000001cef0462200] decode_slice_header error
[h264 # 000001cef0462200] no frame!
*... repeated a lot ...*
Input #0, mpegts, from 'udp://192.168.0.109:5010':
Duration: N/A, start: 128.032333, bitrate: N/A
Program 1
Metadata:
service_name: RARBG.COM - Spotlight.2015.1080p.WEB-DL.DD5.1.H264-RARBG
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(tv, bt709), 1916x1032 [SAR 1:1 DAR 479:258], 23.98 fps, 23.98 tbr, 90k tbn, 180k tbc
Stream #0:1[0x101](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 200 kb/s
[flv # 000001cef132a1c0] Codec for stream 0 does not use global headers but container format requires global headers
[flv # 000001cef132a1c0] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, flv, to '**rtmp://wowzaServerAddress**':
Metadata:
encoder: Lavf57.20.100
Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 1916x1032 [SAR
1:1 DAR 479:258], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 90k tbc
Stream #0:1(eng): Audio: aac ([10][0][0][0] / 0x000A), 48000 Hz, stereo,
200 kb/s
Stream mapping:
Stream #0:0 - #0:0 (copy)
Stream #0:1 - #0:1 (copy)
Press [q] to stop, [?] for help
[flv # 000001cef132a1c0] Malformed AAC bitstream detected: use the audio
bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)
av_interleaved_write_frame(): Invalid data found when processing input
[flv # 000001cef132a1c0] Malformed AAC bitstream detected: use the audio bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)
[flv # 000001cef132a1c0] Failed to update header with correct duration.
[flv # 000001cef132a1c0] Failed to update header with correct filesize.
Error writing trailer of rtmp://**wowzaServerAddress**: Invalid data found when processing inputframe= 1 fps=0.0 q=-1.0 Lsize= 0kB time= 00:00:02.13 bitrate= 1.6kbits/s
video:33kB audio:59kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

Resources