I'm trying to stream avideo file to localhost http stream.
my ffmpeg version details:
ffmpeg version N-64307-g8657612 Copyright (c) 2000-2014 the FFmpeg developers
built on Jun 29 2014 22:09:38 with gcc 4.8.3 (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-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libope
njpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsox
r --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-decklink --enable-zlib
libavutil 52. 90.101 / 52. 90.101
libavcodec 55. 68.100 / 55. 68.100
libavformat 55. 44.100 / 55. 44.100
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 9.100 / 4. 9.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfi
le}...
when I use:
C:\Users\USER>ffmpeg -re -i myfile.mp4 -f flv udp://localhost:1234
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myfile.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.44.100
compilation : 0
Duration: 00:00:04.17, start: 0.036281, bitrate: 268 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [
SAR 1:1 DAR 4:3], 132 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 12
8 kb/s (default)
Metadata:
handler_name : SoundHandler
[flv # 00000000003fc780] Using AVStream.codec.time_base as a timebase hint to th
e muxer is deprecated. Set AVStream.time_base instead.
Last message repeated 1 times
Output #0, flv, to 'udp://localhost:1234':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
compilation : 0
encoder : Lavf55.44.100
Stream #0:0(und): Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p, 640x48
0 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc55.68.100 flv
Stream #0:1(und): Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz,
stereo, fltp (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc55.68.100 libmp3lame
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> flv1 (flv))
Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
frame= 5 fps=0.0 q=2.0 size= 32kB time=00:00:00.44 bitrate= 591.6kbits/s
frame= 18 fps= 18 q=3.6 size= 77kB time=00:00:00.94 bitrate= 668.8kbits/s
frame= 30 fps= 20 q=8.4 size= 115kB time=00:00:01.46 bitrate= 642.5kbits/s
its working.
but when I use http:
C:\Users\USER>ffmpeg -re -i myfile.mp4 -f flv http://localhost:1234
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myfile.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.44.100
compilation : 0
Duration: 00:00:04.17, start: 0.036281, bitrate: 268 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [
SAR 1:1 DAR 4:3], 132 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 12
8 kb/s (default)
Metadata:
handler_name : SoundHandler
http://localhost:1234: Input/output error
I get Input/output error.
in linux its working with ffserver.
but in windows I get this exception.
You are using two different protocols (udp and http) so the outcome of the command is different.
Like Ross said in the comments : "UDP doesn't know or care if there is anything to receive the packets. If there's nothing there ffmpeg won't know and so won't complain".
FFserver is a different command to FFmpeg hence the different outputs.
Linux will behave differently according to distribution. Windows will also behave differently.
It would be easier for us to answer the question if you added a question mark to your question with a phrase summarising what you want to know.
Related
atrim=0:2 starts fine when I play the video it plays the mp3 now how do I add a working end time say finish at 9 seconds?
Summary I want to start at 2 seconds and finish at 9 seconds.
ffmpeg -y -i "C:\Users\test\Desktop\vidz\New folder (2)\target\vaastav song .mp4" -i "C:\Users\test\Desktop\vidz\New folder (2)\target\2.mp3" -filter_complex "[0]atrim=0:2[Apre];[0]atrim=5,asetpts=PTS-STARTPTS[Apost];[Apre][1][Apost]concat=n=3:v=0:a=1" -vcodec copy -y "C:\Users\test\Desktop\vidz\New folder (2)\target\output1.mp4"
log file
ffmpeg version git-2020-04-13-59e3a9a 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 --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-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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.102 / 56. 42.102
libavcodec 58. 78.102 / 58. 78.102
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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\test\Desktop\vidz\New folder (2)\target\vaastav song .mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-09-02T04:28:46.000000Z
Duration: 00:05:08.80, start: 0.000000, bitrate: 2289 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 2160 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
Metadata:
creation_time : 2018-09-02T04:28:46.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 09/01/2018.
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
creation_time : 2018-09-02T04:28:46.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 09/01/2018.
Input #1, mp3, from 'C:\Users\test\Desktop\vidz\New folder (2)\target\2.mp3':
Metadata:
genre : Electronic;Indie
title : A Distorted Noise With A Little Bit Of Sense
artist : Lenin Was A Zombie
encoder : Lavf56.19.100
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
Duration: 00:00:54.00, start: 0.025057, bitrate: 192 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 192 kb/s
Metadata:
encoder : Lavc56.21
Stream mapping:
Stream #0:1 (aac) -> atrim
Stream #0:1 (aac) -> atrim
Stream #1:0 (mp3float) -> concat:in1:a0
concat -> Stream #0:0 (aac)
Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
Output #0, mp4, to 'C:\Users\test\Desktop\vidz\New folder (2)\target\output1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf58.42.100
Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc58.78.102 aac
Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2160 kb/s, 25 fps, 25 tbr, 90k tbn, 90k tbc (default)
Metadata:
creation_time : 2018-09-02T04:28:46.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 09/01/2018.
frame= 737 fps=0.0 q=-1.0 size= 7936kB time=00:00:29.44 bitrate=2208.1kbits/s speed=58.9x
[out_0_0 # 000000000312c900] 100 buffers queued in out_0_0, something may be wrong.
[out_0_0 # 000000000312c900] 1000 buffers queued in out_0_0, something may be wrong.
frame= 1401 fps=876 q=-1.0 size= 16640kB time=00:01:46.85 bitrate=1275.7kbits/s speed=66.8x
frame= 2281 fps=1086 q=-1.0 size= 26112kB time=00:02:22.01 bitrate=1506.3kbits/s speed=67.6x
frame= 3152 fps=1212 q=-1.0 size= 35584kB time=00:02:56.58 bitrate=1650.8kbits/s speed=67.9x
frame= 4011 fps=1294 q=-1.0 size= 45824kB time=00:03:31.32 bitrate=1776.4kbits/s speed=68.2x
frame= 4882 fps=1356 q=-1.0 size= 56320kB time=00:04:06.03 bitrate=1875.2kbits/s speed=68.3x
frame= 5753 fps=1403 q=-1.0 size= 66560kB time=00:04:40.79 bitrate=1941.8kbits/s speed=68.5x
frame= 6622 fps=1440 q=-1.0 size= 77056kB time=00:05:15.37 bitrate=2001.6kbits/s speed=68.6x
frame= 7482 fps=1467 q=-1.0 size= 85248kB time=00:05:50.20 bitrate=1994.1kbits/s speed=68.7x
frame= 7720 fps=1479 q=-1.0 Lsize= 87248kB time=00:05:59.79 bitrate=1986.5kbits/s speed=68.9x
video:81451kB audio:5634kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.186449%
[aac # 0000000003017ac0] Qavg: 648.065
I tried messing about with the line of code but no success so I turn to you for additional support
I have 5 mp4 input videos (audio+video) that I want to 'join' into a single output video with a crossfade effect in between each pair of videos.
I want to 'crossfade' both the audio and the video, with a transition of 0.4s.
(Not an actual crossfade, more like video-2 fades in over video-1, video-1 does not need to fade out, but this is not the problem)
I'm using ffmpeg-4.1.3-win64-static
I have followed many tutorials and answers from here, but there are so many different ways to do it...
Each one of the 5 videos is 1.024s long, duration obtained with ffprobe
ffprobe.exe -i "0.mp4" -show_entries format=duration -v quiet -of csv="p=0"
This is the command for both audio and video:
(I've reformatted the command so it is easier to read, it is issued as a single line in the command prompt)
ffmpeg.exe -y -i "0.mp4" -i "1.mp4" -i "2.mp4" -i "3.mp4" -i "4.mp4"
-filter_complex "
[0:v]setpts=PTS-STARTPTS[v1];
[1:v]format=yuva420p,fade=in:st=0:d=0.4:alpha=1,setpts=PTS-STARTPTS+(0.6/TB)[v2];
[2:v]format=yuva420p,fade=in:st=0:d=0.4:alpha=1,setpts=PTS-STARTPTS+(1.2/TB)[v3];
[3:v]format=yuva420p,fade=in:st=0:d=0.4:alpha=1,setpts=PTS-STARTPTS+(1.8/TB)[v4];
[4:v]format=yuva420p,fade=in:st=0:d=0.4:alpha=1,setpts=PTS-STARTPTS+(2.4/TB)[v5];
[v1][v2]overlay[u1];[u1][v3]overlay[u2];[u2][v4]overlay[u3];[u3][v5]overlay,format=yuv420p[v];
[0][1]acrossfade=d=0.4[a0];
[a0][2]acrossfade=d=0.4[a1];
[a1][3]acrossfade=d=0.4[a2];
[a2][4]acrossfade=d=0.4[a]
" -map [v] -map [a] "output.mp4"
When I do both audio and video into a single output file, output.mp4 can not be played on VLC, this is the vlc log:
main debug: `file:///C:/project/input-videos/output.mp4' gives access `file' demux `any' path `/C:project/input-videos/output.mp4'
main debug: creating demux: access='file' demux='any' location='/C:/project/input-videos/output.mp4' file='C:\project\input-videos\output.mp4'
main debug: looking for access_demux module matching "file": 15 candidates
main debug: no access_demux modules matched
main debug: creating access: file:///C:/project/input-videos/output.mp4
main debug: (path: C:\project\input-videos\output.mp4)
main debug: looking for access module matching "file": 26 candidates
main debug: using access module "filesystem"
main debug: looking for stream_filter module matching "prefetch,cache_read": 24 candidates
cache_read debug: Using stream method for AStream*
cache_read debug: starting pre-buffering
cache_read error: cannot pre fill buffer
main debug: looking for meta fetcher module matching "any": 1 candidates
main debug: no stream_filter modules matched
main warning: cannot insert stream filter prefetch,cache_read
main debug: looking for stream_filter module matching "any": 24 candidates
playlist debug: not enough data
...
This is the output from ffmpeg:
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.3.1 (GCC) 20190414
configuration: --enable-gpl --enable-version3 --enable-sdl2 --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-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
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
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '0.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
location-eng : +52.6899-001.8293/
location : +52.6899-001.8293/
Duration: 00:00:01.02, start: 0.000000, bitrate: 13821 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2224x1080 [SAR 1:1 DAR 278:135], 14002 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandle
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
location-eng : +53.4256-001.3580/
location : +53.4256-001.3580/
Duration: 00:00:01.02, start: 0.000000, bitrate: 7094 kb/s
Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2224x1080 [SAR 1:1 DAR 278:135], 7113 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandle
Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandle
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
location-eng : +53.3927-001.5044/
location : +53.3927-001.5044/
Duration: 00:00:01.02, start: 0.000000, bitrate: 7367 kb/s
Stream #2:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2224x1080 [SAR 1:1 DAR 278:135], 7394 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandle
Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 126 kb/s (default)
Metadata:
handler_name : SoundHandle
Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '3.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
location-eng : +53.3927-001.5044/
location : +53.3927-001.5044/
Duration: 00:00:01.02, start: 0.000000, bitrate: 8145 kb/s
Stream #3:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2224x1080 [SAR 1:1 DAR 278:135], 8192 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandle
Stream #3:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
handler_name : SoundHandle
Input #4, mov,mp4,m4a,3gp,3g2,mj2, from '4.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
location-eng : +53.3927-001.5044/
location : +53.3927-001.5044/
Duration: 00:00:01.02, start: 0.000000, bitrate: 6241 kb/s
Stream #4:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2224x1080 [SAR 1:1 DAR 278:135], 6241 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandle
Stream #4:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 126 kb/s (default)
Metadata:
handler_name : SoundHandle
Stream mapping:
Stream #0:0 (h264) -> setpts
Stream #0:1 (aac) -> acrossfade:crossfade0
Stream #1:0 (h264) -> format
Stream #1:1 (aac) -> acrossfade:crossfade1
Stream #2:0 (h264) -> format
Stream #2:1 (aac) -> acrossfade:crossfade1
Stream #3:0 (h264) -> format
Stream #3:1 (aac) -> acrossfade:crossfade1
Stream #4:0 (h264) -> format
Stream #4:1 (aac) -> acrossfade:crossfade1
format -> Stream #0:0 (libx264)
acrossfade -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
When I do the video only it is fine. The duration of the output.mp4 file generated for video-only is 3.4s
When I do the audio only it is also fine. The duration of the output.mp4 file generated for audio-only is 3.435s
This is the command for video only:
ffmpeg.exe -y -i "0.mp4" -i "1.mp4" -i "2.mp4" -i "3.mp4" -i "4.mp4"
-filter_complex "
[0:v]setpts=PTS-STARTPTS[v1];
[1:v]format=yuva420p,fade=in:st=0:d=0.4:alpha=1,setpts=PTS-STARTPTS+(0.6/TB)[v2];
[2:v]format=yuva420p,fade=in:st=0:d=0.4:alpha=1,setpts=PTS-STARTPTS+(1.2/TB)[v3];
[3:v]format=yuva420p,fade=in:st=0:d=0.4:alpha=1,setpts=PTS-STARTPTS+(1.8/TB)[v4];
[4:v]format=yuva420p,fade=in:st=0:d=0.4:alpha=1,setpts=PTS-STARTPTS+(2.4/TB)[v5];
[v1][v2]overlay[u1];[u1][v3]overlay[u2];[u2][v4]overlay[u3];[u3][v5]overlay,format=yuv420p[v]
" -map [v] "output.mp4"
This is the command for audio only:
ffmpeg.exe -y -i "0.mp4" -i "1.mp4" -i "2.mp4" -i "3.mp4" -i "4.mp4"
-filter_complex "
[0][1]acrossfade=d=0.4[a0];
[a0][2]acrossfade=d=0.4[a1];
[a1][3]acrossfade=d=0.4[a2];
[a2][4]acrossfade=d=0.4[a]
" -map [a] "output.mp4"
What am I missing in order to generate one output file with both audio and video content?
Edit: Here's the full ffmpeg command + result for audio and video combined with "-loglevel debug" added. (Too big to add directly here, so I've added it to Pastebin)
https://pastebin.com/NLBc7Abb
Work Around
Not a solution, but I found a work around:
Create video only output using command above, output to video.mp4
Create audio only output using command above, output to audio.mp4
Merge both video.mp4 and audio.mp4 into output.mp4 using the following command:
ffmpeg.exe -y -i "video.mp4" -i "audio.mp4" -c:v copy -c:a aac output.mp4
If anyone has any ideas as to why the combined audio+video command does not work, please let me know. :)
Using the FFmpeg build found here: https://github.com/illuspas/ffmpeg-hw-win32
gcc 5.3.0
--enable-nvenc nvidia_video_sdk_6.0.1
--enable-libmfx Intel(R)_Media_SDK_2016.0.1
--enable-libfdk-aac 0.1.4
--enable-libspeex 1.2rc1
--enable-libx264 1:148.20150725
--enable-libopenh264 1.5.0
--enable-libx265 1.8
--enable-libopus 1.1.2
--enable-libmp3lame 3.99.5
--enable-libkvazaar 0.8.2
./configure --prefix=/home/aliang/FFmpeg/x86_64 --enable-small --disable-debug --disable-doc --arch=x86_64 --cc='ccache x86_64-w64-mingw32-gcc' --cross-prefix=x86_64-w64-mingw32- --enable-cross-compile --target-os=mingw32 --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libspeex --enable-libx264 --enable-libx265 --enable-libmfx --enable-nvenc --enable-libopenh264 --enable-libkvazaar --enable-gpl --enable-nonfree
I'm running Windows on a MacBook Pro. I also tried with a more recent build and had the same output.
Input video is from sample-videos.com.
The ffmpeg command I am running is:
ffmpeg -y -i sample.mp4 -vcodec nvenc_h264 -pixel_format yuv420p -f mp4 sample-out-nvenc.mp4
sample-out-nvenc.mp4 looks like this via ffplay or vlc:
When I grab a frame using jpeg2, the colors appear normal, but the height is squished.
ffmpeg -y -ss 15.5 -i sample.mp4 -vframes 1 -s 480x300 -f image2 grab.jpg
The ffprobe results for the output (sample-out-nvenc.mp4):
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample-out-nvenc.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.25.100
Duration: 00:00:31.02, start: 0.021333, bitrate: 1994 kb/s
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv), 640x480 [SAR 1:1 DAR 4:3], 1650 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 342 kb/s (default)
Metadata:
handler_name : SoundHandler
Lastly the output from the nvenc encoding command:
ffmpeg -y -i sample.mp4 -vcodec nvenc_h264 -pixel_format yuv420p -f mp4 sample-out-nvenc.mp4
ffmpeg version 3.0 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.0 (GCC)
configuration: --prefix=/home/aliang/FFmpeg/x86_64 --enable-small --disable-debug --disable-doc --arch=x86_64 --cc='ccache x86_64-w64-mingw32-gcc' --cross-prefix=x86_64-w64-mingw32- --enable-cross-compile --target-os=mingw32 --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libspeex --enable-libx264 --enable-libx265 --enable-libmfx --enable-nvenc --enable-libopenh264 --enable-libkvazaar --enable-gpl --enable-nonfree
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
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 'sample.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.24.2
Duration: 00:00:31.00, start: 0.000000, bitrate: 1353 kb/s
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 966 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Output #0, mp4, to 'sample-out-nvenc.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.25.100
Stream #0:0(und): Video: h264 (nvenc_h264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 2000 kb/s, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
encoder : Lavc57.24.102 nvenc_h264
Side data:
unknown side data type 10 (24 bytes)
Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, 5.1, fltp, 341 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
encoder : Lavc57.24.102 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (nvenc_h264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 774 fps=253 q=-0.0 Lsize= 7551kB time=00:00:30.99 bitrate=1995.6kbits/s speed=10.1x
video:6236kB audio:1297kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.243011%
[aac # 000001cdd9900520] Qavg: 743.457
I had exactly the same problem, with a GTX 980. This started after installing driver update 368.22. I downloaded and reverted to driver version 365.19 from the nividia driver archive and the problem went away.
So it appears to affect all nvidia cards and drivers.
I experienced the same problem with nvenc through another usecase. It seems to have been caused by the latest nvidia quadro driver. The problem was resolved when I reverted it. As you have a macbook, I guess it's fair to assume you don't have a quadro card, but it still might be a driver problem.
I am concatenating three videos using ffmpeg. However, for some reasons I am getting error.
I am using NReco Video Converter which is a FFMpeg C# wrapper .
Any help would be highly appreciated.
Below is my complete console output :
C:\ffmpeg-20151130-git-7b11eea-win64-static\ffmpeg-20151130`enter code here`
-git-7b11eea-win64-static\bin
>ffmpeg -i I.mp4 -i V.mp4 -i O.mp4 -t 500 -f mp4 -s 1080*720 -filter_complex "co
ncat=n=3:v=1 [v]" -map "[v]" output.mp4
ffmpeg version N-76957-g7b11eea Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (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-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --
enable-lzma --enable-decklink --enable-zlib
libavutil 55. 9.100 / 55. 9.100
libavcodec 57. 16.101 / 57. 16.101
libavformat 57. 19.100 / 57. 19.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 17.100 / 6. 17.100
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 'I.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.12.100
Duration: 00:00:03.52, start: 0.036281, bitrate: 2041 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x720
[SAR 40:33 DAR 20:11], 1926 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp,
128 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'V.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.12.100
Duration: 00:00:31.29, start: 0.036281, bitrate: 1560 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x720,
1428 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp,
128 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'O.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.12.100
Duration: 00:00:03.52, start: 0.036281, bitrate: 2041 kb/s
Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x720
[SAR 40:33 DAR 20:11], 1926 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp,
128 kb/s (default)
Metadata:
handler_name : SoundHandler
[Parsed_concat_0 # 000000d2ed8bee80] Input link in1:v0 parameters (size 1080x720
, SAR 0:1) do not match the corresponding output link in0:v0 parameters (1080x72
0, SAR 40:33)
[Parsed_concat_0 # 000000d2ed8bee80] Failed to configure output pad on Parsed_concat_0
Error configuring complex filters.
Invalid argument
As you can see from the console output the issue is that the three inputs have different SAR values: 0:1 for the second input vs 40:33 for the first and third inputs.
You can set the corect SAR value using the setsar filter, eg:
[1:v:0]setsar=sar=40/33[1v0sar]
then pass [1v0sar] to the concat filter along with the other video streams.
ffmpeg newbie here struggling to do something that apparently should be easy.
I want to concatenate three videos, being one of them just a blank video two seconds transition.
First I generate the blank video with:
ffmpeg -f lavfi -i color=c=black:s=320x240:d=0.5 silent.mp4
After I try to concat it with two other videos I have:
ffmpeg -i video-a.mp4 -i 2-seconds-silent-video.mp4 -i video-b.mp4 -y -filter_complex concat=n=3:v=1:a=1 result.mp4
What I'm getting:
ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.7.2_1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libvpx --enable-libfdk-aac --enable-libx265 --enable-nonfree --enable-vda
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, mov,mp4,m4a,3gp,3g2,mj2, from 'video-a.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:03.03, start: 0.033333, bitrate: 822 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 691 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '2-seconds-silent-video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:02.00, start: 0.000000, bitrate: 17 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 11 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'video-b.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:03.03, start: 0.033333, bitrate: 745 kb/s
Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 613 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 129 kb/s (default)
Metadata:
handler_name : SoundHandler
Cannot find a matching stream for unlabeled input pad 5 on filter Parsed_concat_0
What I also tried without success:
ffmpeg -y -i "concat:video-a.mp4|2-seconds-silent-video.mp4|video-b.mp4" -c copy result.mp4
Result:
ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.7.2_1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libvpx --enable-libfdk-aac --enable-libx265 --enable-nonfree --enable-vda
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
[mov,mp4,m4a,3gp,3g2,mj2 # 0x7fd12a812800] Found duplicated MOOV Atom. Skipped it
Last message repeated 1 times
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'concat:video-a.mp4|2-seconds-silent-video.mp4|video-b.mp4':
Metadata:
encoder : Lavf56.40.101
minor_version : 512
major_brand : isom
compatible_brands: isomiso2avc1mp41
Duration: 00:00:03.03, start: 0.033333, bitrate: 1579 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 691 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
[mp4 # 0x7fd12a033a00] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 # 0x7fd12a033a00] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, mp4, to 'result.mp4':
Metadata:
compatible_brands: isomiso2avc1mp41
minor_version : 512
major_brand : isom
encoder : Lavf56.36.100
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 691 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 75 fps=0.0 q=-1.0 Lsize= 305kB time=00:00:03.05 bitrate= 818.1kbits/s
video:253kB audio:48kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.179313%
There's no audio stream when I generate my blank video. The solution is add a silent audio stream to the video:
ffmpeg -y -f lavfi -i anullsrc -i 2-seconds-silent-video.mp4 -shortest -c:v copy -c:a aac -strict experimental silent-video.mp4
answered here by #miindlek, thank you.
where I found the line above: adding silent audio in ffmpeg