ffmpeg audio conversion: encoder pcm_u8 working pcm_s8 not - audio

I need to convert audio inside video to 8 Bit signed PCM. I try it like this:
C:\Users\E\Desktop\ffmpeg-20160731-04da20e-win32-static\bin>ffmpeg -i minions.mp4 -vcodec mjpeg -s 800x480 -acodec pcm_s8 -ac 1 out.avi
output:
ffmpeg version N-81192-g04da20e Copyright (c) 2000-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-lib
ebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfree
type --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-lib
openjpeg --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. 28.100 / 55. 28.100
libavcodec 57. 51.100 / 57. 51.100
libavformat 57. 44.100 / 57. 44.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 49.100 / 6. 49.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'minions.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2016-03-17 10:06:57
Duration: 00:03:18.72, start: 0.000000, bitrate: 1869 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1675 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default
)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
creation_time : 2016-03-17 10:06:58
handler_name : IsoMedia File Produced by Google, 5-11-2011
[swscaler # 04821880] deprecated pixel format used, make sure you did set range correctly
[avi # 048c0460] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, avi, to 'out.avi':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf57.44.100
Stream #0:0(und): Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc), 800x480 [SAR 16:15 DAR 16:9], q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.51.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: pcm_s8, 44100 Hz, mono, u8, 352 kb/s (default)
Metadata:
creation_time : 2016-03-17 10:06:58
handler_name : IsoMedia File Produced by Google, 5-11-2011
encoder : Lavc57.51.100 pcm_s8
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Stream #0:1 -> #0:1 (aac (native) -> pcm_s8 (native))
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
ffmpeg can not write a header for output file. I want to mention that if audio encoder is selected to pcm_u8 everything works fine.
C:\Users\E\Desktop\ffmpeg-20160731-04da20e-win32-static\bin>ffmpeg -i minions.mp4 -vcodec mjpeg -s 800x480 -acodec pcm_u8 -ac 1 out.avi
output:
ffmpeg version N-81192-g04da20e Copyright (c) 2000-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-lib
ebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfree
type --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-lib
openjpeg --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. 28.100 / 55. 28.100
libavcodec 57. 51.100 / 57. 51.100
libavformat 57. 44.100 / 57. 44.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 49.100 / 6. 49.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'minions.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2016-03-17 10:06:57
Duration: 00:03:18.72, start: 0.000000, bitrate: 1869 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1675 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default
)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
creation_time : 2016-03-17 10:06:58
handler_name : IsoMedia File Produced by Google, 5-11-2011
File 'out.avi' already exists. Overwrite ? [y/N] y
[swscaler # 030a1880] deprecated pixel format used, make sure you did set range correctly
[avi # 04a10460] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, avi, to 'out.avi':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
ISFT : Lavf57.44.100
Stream #0:0(und): Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc), 800x480 [SAR 16:15 DAR 16:9], q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.51.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: pcm_u8 ([1][0][0][0] / 0x0001), 44100 Hz, mono, u8, 352 kb/s (default)
Metadata:
creation_time : 2016-03-17 10:06:58
handler_name : IsoMedia File Produced by Google, 5-11-2011
encoder : Lavc57.51.100 pcm_u8
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Stream #0:1 -> #0:1 (aac (native) -> pcm_u8 (native))
Press [q] to stop, [?] for help
frame= 4764 fps=250 q=24.8 Lsize= 74247kB time=00:03:18.71 bitrate=3060.8kbits/s speed=10.4x
video:65364kB audio:8558kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.438745%
What is the problem ? Why conversion does not work for signed pcm ?
Encoders for both unsigned and signed pcm are avaible:
C:\Users\E\Desktop\ffmpeg-20160731-04da20e-win32-static\bin>ffmpeg -encoders
.
.
A..... pcm_f32be PCM 32-bit floating point big-endian
A..... pcm_f32le PCM 32-bit floating point little-endian
A..... pcm_f64be PCM 64-bit floating point big-endian
A..... pcm_f64le PCM 64-bit floating point little-endian
A..... pcm_mulaw PCM mu-law / G.711 mu-law
A..... pcm_s16be PCM signed 16-bit big-endian
A..... pcm_s16be_planar PCM signed 16-bit big-endian planar
A..... pcm_s16le PCM signed 16-bit little-endian
A..... pcm_s16le_planar PCM signed 16-bit little-endian planar
A..... pcm_s24be PCM signed 24-bit big-endian
A..... pcm_s24daud PCM D-Cinema audio signed 24-bit
A..... pcm_s24le PCM signed 24-bit little-endian
A..... pcm_s24le_planar PCM signed 24-bit little-endian planar
A..... pcm_s32be PCM signed 32-bit big-endian
A..... pcm_s32le PCM signed 32-bit little-endian
A..... pcm_s32le_planar PCM signed 32-bit little-endian planar
A..... pcm_s8 PCM signed 8-bit
A..... pcm_s8_planar PCM signed 8-bit planar
A..... pcm_u16be PCM unsigned 16-bit big-endian
A..... pcm_u16le PCM unsigned 16-bit little-endian
A..... pcm_u24be PCM unsigned 24-bit big-endian
A..... pcm_u24le PCM unsigned 24-bit little-endian
A..... pcm_u32be PCM unsigned 32-bit big-endian
A..... pcm_u32le PCM unsigned 32-bit little-endian
A..... pcm_u8 PCM unsigned 8-bit
.
.

Your error not about audio, it's about video:
[swscaler # 04821880] deprecated pixel format used, make sure you did set range correctly
[avi # 048c0460] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
I think you can try to set pixel format as it asking. it could solve it.
I want to mention that if audio encoder is selected to pcm_u8 everything works fine.
Please, place the command for this convertion and the output (averything before 'stream mapping' including it) in your qustion by editing it.

The RIFF function called by the AVI muxer does not support writing a tag for PCM_S8 streams, so apparently that's why you can't write it to AVIs or WAVs.
You can use MOV or NUT formats.
If you need to use AVI, you are left with S16LE, S24LE, S32LE, F32LE, F64LE and U8 variants of LPCM.
To encode using IMA ADPCM, use
ffmpeg -i minions.mp4 -c:v mjpeg -s 800x480 -c:a adpcm_ima_wav -ac 1 out.avi
To encode using mu-law PCM, use
ffmpeg -i minions.mp4 -c:v mjpeg -s 800x480 -c:a pcm_mulaw -ac 1 out.avi

My company is building a device using the FT810 and this is the conversion script I have come up with:
AUDIO_SAMPLE_RATE=8000
VIDEO_FRAME_RATE=8
VIDEO_Y_POS=266 # Place video in 2/3rds up from bottom of screen
ffmpeg -i source/audio.mp3 -r 65535/2733 -vn -c:a libmp3lame -ar $AUDIO_SAMPLE_RATE -ac 1 -ab 128k -y /tmp/resampled.mp3
ffmpeg -i source/video.gif \
-i /tmp/resampled.mp3 \
-filter:v scale=420:-2,pad=420:270+ih/2:0:270-ih/2:black \
-pix_fmt yuvj420p -vcodec mjpeg -acodec pcm_s16le -r:v $VIDEO_FRAME_RATE -b:v 0.1M -ac 1 -shortest -y output/startup.avi
Notice that I am using pcm_s16le, because the documentation says "16 Bit PCM is partially supported by dropping off less significant 8 bits in each
audio sample."

Related

ffmpeg issue after adding background audio

So I have an issue to which I cannot find an answer. I have a video which is 7min 38sec long after concat. When I want to add background audio to this video it cuts off the last 7sec of the original video. I cannot find the reason.
If anyone could help me in any way, it would be amazing because I have been troubleshooting this past 3 days.
My FFmpeg version is ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers.
For concat I use this: FFmpeg -f concat -safe 0 -i txtfile.txt -c copy -ac 2 output.mp4
For adding background audio I use this: ffmpeg -i output.mp4 -i background.mp3 -c:v copy -filter_complex "[0:a]aformat=fltp:44100:stereo,apad[0a];[1]aformat=fltp:44100:stereo,volume=0.2[1a];[0a][1a]amerge[a]" -map 0:v -map "[a]" -ac 2 -shortest output_with_background.mp4
And the console output while doing its stuff is:
ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200523
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. 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
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0000024baee72440] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'C:\Users\shooey\Desktop\junky\Content\07-04-2021\videos.txt':
Duration: N/A, start: -0.023220, bitrate: 18916 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 18861 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 54 kb/s
Metadata:
handler_name : SoundHandler
File 'C:\Users\shooey\Desktop\junky\Content\07-04-2021\output.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'C:\Users\shooey\Desktop\junky\Content\07-04-2021\output.mp4':
Metadata:
encoder : Lavf58.29.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 18861 kb/s, 30 fps, 30 tbr, 15360 tbn, 15360 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 54 kb/s
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 # 0000024baee72440] Auto-inserting h264_mp4toannexb bitstream filter
Last message repeated 5 times
[mov,mp4,m4a,3gp,3g2,mj2 # 0000024baeeec180] Auto-inserting h264_mp4toannexb bitstream filter
[mov,mp4,m4a,3gp,3g2,mj2 # 0000024baee72440] Auto-inserting h264_mp4toannexb bitstream filter
Last message repeated 14 times
[mov,mp4,m4a,3gp,3g2,mj2 # 0000024baee72440] Auto-inserting h264_mp4toannexb bitstream filter
Last message repeated 20 times
[mov,mp4,m4a,3gp,3g2,mj2 # 0000024baee72440] Auto-inserting h264_mp4toannexb bitstream filter
Last message repeated 7 times
frame= 52 fps= 42 q=-1.0 Lsize= 7838kB time=00:07:38.82 bitrate= 139.9kbits/s speed= 374x
video:4802kB audio:2956kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.044608%
ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200523
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. 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
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\shooey\Desktop\junky\Content\07-04-2021\output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Duration: 00:07:38.85, start: 0.000000, bitrate: 139 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 87 kb/s, 0.12 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 52 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mp3, from 'C:\Users\shooey\Desktop\junky\Content\assets\background.mp3':
Metadata:
major_brand : dash
Software : Lavf57.56.101
minor_version : 0
compatible_brands: iso6mp41
Duration: 00:20:03.02, start: 0.025057, bitrate: 167 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 167 kb/s
Metadata:
encoder : LAME3.100
File 'C:\Users\shooey\Desktop\junky\Content\07-04-2021\output_bckg.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:1 (aac) -> aformat
Stream #1:0 (mp3float) -> aformat
Stream #0:0 -> #0:0 (copy)
amerge -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[Parsed_amerge_4 # 0000017093965c80] No channel layout for input 1
[Parsed_amerge_4 # 0000017093965c80] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
Output #0, mp4, to 'C:\Users\shooey\Desktop\junky\Content\07-04-2021\output_bckg.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 87 kb/s, 0.12 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc58.54.100 aac
frame= 52 fps=5.5 q=-1.0 Lsize= 11993kB time=00:07:31.67 bitrate= 217.5kbits/s speed= 48x
video:4802kB audio:7111kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.670061%
[aac # 00000170935b4980] Qavg: 319.394
I think I found the answer by myself. I took the background.mp3 which I wanted to add and made it into a .aac audio file. After that I used the same command for adding audio but instead of -shortest I used -t 00:07:38 because it was the length of the video and I found that FFmpeg has a hard time recognizing the boundaries in videos.

FFMPEG - Merge mp4 files and audio file

I have an ffmpeg that merges 3 mp4 videos and then another command that adds audio to the output file from the first command. The commands are as follows:
ffmpeg -i vid-1.mp4 -i vid-2.mp4 -i vid-3.mp4 -filter_complex "[0:v][1:v][2:v]concat=n=3:v=1" -preset ultrafast -crf 1 output.mp4
ffmpeg -i output.mp4 -i audio.mp3 -preset ultrafast -crf 1 final.mp4
vid-1.mp4 (does NOT have audio stream)
vid-2.mp4 (does NOT have audio stream)
Is there anyway to do this in one command? I would like to also add the audio to the video that is getting created in the first command. Is this possible?
Console output of "ffmpeg -i vid-1.mp4 -i vid-2.mp4 -i vid-3.mp4 -i audio.mp3"
[jstevens#jr testing]$ ffmpeg -i vid-1.mp4 -i vid-2.mp4 -i vid-3.mp4 -i audio.mp3
ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 6.1.1 (GCC) 20160510 (Red Hat 6.1.1-2)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vid-1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.25.101
Duration: 00:00:05.00, start: 0.000000, bitrate: 1085 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1081 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'vid-2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.25.101
Duration: 00:00:05.00, start: 0.000000, bitrate: 1018 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1014 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'vid-3.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.25.101
Duration: 00:00:05.00, start: 0.000000, bitrate: 823 kb/s
Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 819 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
[mp3 # 0x1ca30c0] Skipping 0 bytes of junk at 0.
[mp3 # 0x1ca30c0] Estimating duration from bitrate, this may be inaccurate
Input #3, mp3, from 'audio.mp3':
Duration: 00:00:19.57, start: 0.000000, bitrate: 64 kb/s
Stream #3:0: Audio: mp3, 44100 Hz, mono, s16p, 64 kb/s
At least one output file must be specified
ffmpeg -i vid-1.mp4 -i vid-2.mp4 -i vid-3.mp4 -i audio.mp3 \
-filter_complex "[0:v][1:v][2:v]concat=n=3:v=1:a=0[v]" \
-map "[v]" -map 3:a -shortest output.mp4
I recommend to manually define mappings with -map instead of relying on the default stream selection behavior.
The -shortest option is added because the concatenated video duration is shorter than the audio duration.

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!

Using ffmpeg to convert a MOV file from a Nikon 3200D camera into a intermediate (mpegts) format - audio issue

I am using a command found on SO to convert from MOV to the intermediate format. The reason for this middle step is to be able to concatenate a series of MOV files.
For some reason, when I run the following command:
ffmpeg -i source.mov -c copy -bsf:v h264_mp4toannexb -f mpegts dest.ts
I lose the audio.
I tried adding -bsf:s pcm_s16le but that did not change an iota.
Here is the output
ffmpeg version N-74313-g9c0407e Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-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 --ena
ble-decklink --enable-zlib
libavutil 54. 30.100 / 54. 30.100
libavcodec 56. 57.100 / 56. 57.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 32.100 / 5. 32.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'source.mov':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt niko
creation_time : 2015-12-29 20:27:21
Duration: 00:00:47.28, start: 0.000000, bitrate: 22117 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/bt470m), 1920x1080 [SAR 1:1 DAR 16:9], 20535 kb/s, 25 fps, 25 tbr, 25
k tbn, 50 tbc (default)
Metadata:
creation_time : 2015-12-29 20:27:21
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
Metadata:
creation_time : 2015-12-29 20:27:21
File 'dest.ts' already exists. Overwrite ? [y/N] y
Output #0, mpegts, to 'dest.ts':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt niko
encoder : Lavf56.40.101
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuvj420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 20535 kb/s, 25 fps, 25 tbr, 90k tbn, 25k tbc (default)
Metadata:
creation_time : 2015-12-29 20:27:21
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, 1536 kb/s (default)
Metadata:
creation_time : 2015-12-29 20:27:21
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1182 fps=1139 q=-1.0 Lsize= 137797kB time=00:00:47.28 bitrate=23875.6kbits/s
video:118525kB audio:8865kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.169999%
From the output, it does look like I copied both the video stream and the audio stream. So what seems to be the trouble?

ffmpeg 1 image (JPG) + 1 audio file (MP3) = 1 video (WEBM) using real encode (-re)

I'd like to make video streaming to distribute it in a streaming.
The mp3 file is being extracted from a video file (which is being recorded live) and, while audio being extracted (MP3), I want to take this audio file and a image it and spread it in a real time streaming. But -re is not working for this.
To extract audio file i use:
ffmpeg.exe -re -i file(LIVE).AVI -vn -ar 22050 -ab 16k -r 1 -ac 1 -f mp3 C:\Users\" & wshNetwork.Username & "\Documents\audio.mp3"
This work very well to make the MP3 file. Using -re.
After that, I'm using this command to marge the auvio file with the jpg image:
ffmpeg.exe -loop 1 -f image2 -i c:\picture.jpg -re -i c:\Users\" & wshNetwork.Username & "\Documents\audio.mp3 -vb 10k -ar 22050 -ab 16k -ac 1 -r 1 -bufsize 300k -f webm www.adress.com
This second command is not working because the -re is not working, and produce a video with the picture and a choppy audio.
the output is:
ffmpeg version N-63113-g72dcd48 Copyright (c) 2000-2014 the FFmpeg developers
built on May 12 2014 22:10:08 with gcc 4.8.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable
-decklink --enable-zlib
libavutil 52. 83.100 / 52. 83.100
libavcodec 55. 61.100 / 55. 61.100
libavformat 55. 37.102 / 55. 37.102
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 5.100 / 4. 5.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, image2, from 'c:\imagens\radiobb.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj420p(pc), 553x342 [SAR 96:96 DAR 553:342], 25
fps, 25 tbr, 25 tbn, 25 tbc
[mp3 # 0000000002b8f660] Estimating duration from bitrate, this may be inaccurat
e
Input #1, mp3, from 'C:\Users\f3548956\Documents\audio.mp3':
Metadata:
encoder : Lavf55.37.102
Duration: 00:00:09.34, start: 0.050113, bitrate: 16 kb/s
Stream #1:0: Audio: mp3, 22050 Hz, mono, s16p, 16 kb/s
[swscaler # 0000000002ae1640] deprecated pixel format used, make sure you did se
t range correctly
[libvpx # 0000000002a8da40] v1.3.0
Output #0, webm, to 'http://172.17.146.***:8080/publish/tvbb100?password=****'
:
Metadata:
encoder : Lavf55.37.102
Stream #0:0: Video: vp8 (libvpx), yuv420p, 553x342 [SAR 1:1 DAR 553:342], q=
-1--1, 10 kb/s, 1k tbn, 25 tbc
Stream #0:1: Audio: vorbis (libvorbis), 22050 Hz, mono, fltp, 16 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg -> libvpx)
Stream #1:0 -> #0:1 (mp3 -> libvorbis)
Press [q] to stop, [?] for help
frame= 33 fps=0.0 q=0.0 size= 4kB time=00:00:01.32 bitrate= 23.3kbits/s
frame= 67 fps= 66 q=0.0 size= 4kB time=00:00:02.68 bitrate= 11.5kbits/s
frame= 101 fps= 66 q=0.0 size= 11kB time=00:00:04.04 bitrate= 22.4kbits/s
frame= 133 fps= 66 q=0.0 size= 11kB time=00:00:05.32 bitrate= 17.0kbits/s
Can anybody help me?

Resources