Why does the ffmpeg process hang? - linux

I try to make video from 2 jpeg (6912x3456 px, files is large it is 360 panoramas) with ffmpeg by
ffmpeg -r 1/4 -pattern_type glob -i "my_dir/*.jpg" -c:v libx264 -profile:v high -crf 18 -vf "fps=30,format=yuv420p" -movflags +faststart output.mp4
And ffmpeg process hang. I get
ffmpeg version 3.2.15-0+deb9u1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --prefix=/usr --extra-version=0+deb9u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --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 --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
Input #0, image2, from 'b90f8cc38a3ec7f6c4665ae0ba0e2b06/*.jpg':
Duration: 00:00:00.08, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 6912x3456, 25 tbr, 25 tbn, 25 tbc
File 'output.mp4' already exists. Overwrite ? [y/N] y
[swscaler # 0x564d13ed9ac0] deprecated pixel format used, make sure you did set range correctly
[libx264 # 0x564d13ecadc0] frame MB size (432x216) > level limit (36864)
[libx264 # 0x564d13ecadc0] DPB size (4 frames, 373248 mbs) > level limit (1 frames, 184320 mbs)
[libx264 # 0x564d13ecadc0] MB rate (2799360) > level limit (2073600)
[libx264 # 0x564d13ecadc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 # 0x564d13ecadc0] profile High, level 5.2
[libx264 # 0x564d13ecadc0] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf57.56.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 6912x3456, q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc57.64.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[output stream 0:0 # 0x564d13ec6c60] 100 buffers queued in output stream 0:0, something may be wrong.
And htop shows
And only Ctrl+C helps.
But when there is one jpg file in the folder, ffmpeg is work fine.
My ffmpeg command works fine on another PC with WSL Debian on Win10. What is problem?

Your linked x264 is too old and therefore has a max level of 5.2 which 6912x3456#30 is past the level limit (as shown by your ffmpeg process output). While exceeding the limit may or may not be the reason for the hang I expect a newer version of x264 will support level 6.0 and will not hang. You have several options:
Upgrade your x264 (and your ffmpeg while you're at it as the 3.2 branch is from 2016). See the compile guide or download a recent ffmpeg with modern libx264 included.
Or add the scale filter and try to stay within the level limits: -vf "scale=4096:-2,fps=30,format=yuv420p"
Or try -c:v libx265 instead of -c:v libx264 (it also has levels to be aware of).
Or you may have just not waited long enough.

Related

Audio on TS File Falls Progressively Out of Sync

I would really appreciate some help with this...
I have a .ts file I've downloaded from the internet, when I play in Quicktime the video progressively falls behind the audio. It becomes noticeable after a couple of minutes and is a few seconds out after about ten minutes. It plays fine in VLC, but I want to be able to play on my AppleTV which does the same as Quicktime.
I've tried everything I can think of to resolve...
Convert with VLC, which does work, but every few seconds the audio skips.
Convert with Handbrake, which again works, but every few seconds the audio skips like with VLC.
Convert with FFMpeg using -async, but I get the same result again with the audio skips.
Extracted the audio and video to two separate files and recreated a new file with FFMpeg, this makes no difference and is the same as playing the original file.
Tried "stretching" the audio with FFMpeg using "aresample=async=1000", which synchronises but the audio is distorted.
I think the audio skips I'm getting from the -async option are caused because the audio is being trimmed to sync with the video. What I want to do is adjust the video to fit with the audio and leave the audio unchanged.
I've tried to do this with -vsync, but the the results are the same as the original file. The FFMpeg user guide says the following:
With -map you can select from which stream the timestamps should be taken. You can leave either video or audio unchanged and sync the remaining stream(s) to the unchanged one.
But I cannot figure out the syntax. This is what I'm trying but the output is the same as the original...
ffmpeg -vsync 1 -I test.ts -map 0:1 -map 0:0 -y test.mp4
I've tried the above using vsync with 0, 1 and 2, but the result is still the same.
Could anyone please help me with the syntax to sync the video stream to the audio stream and leave the audio unchanged? Or suggest an alternative method I could use?
Any help would be really, really appreciated. Thanks.
Here is the ffprobe for test.ts...
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_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-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mpegts, from 'TEst.ts':
Duration: 02:13:05.51, start: 1.406000, bitrate: 4579 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080, 23.98 tbr, 90k tbn, 1411200000.00 tbc
Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 195 kb/s

FFMPEG - Concating multiple clips produce corrupted output (freeze video, audio loss, lengthy duration)

I am trying to concat multiple clips using FFMPEG
My input videos have the following details:
input1.mp4
ffprobe version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2007-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:05:11.75, start: 0.000000, bitrate: 1338 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1204 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 11/09/2018.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 11/09/2018.
input2.mp4
ffprobe version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2007-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:00:05.62, start: 0.000000, bitrate: 2479 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1260x720 [SAR 1:1 DAR 7:4], 2376 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
I have tried 2 approaches but none seemed to work properly.
Approach #1: Using ffmpeg concat filter
Steps:
ffmpeg -i input1.mp4 -qscale:v 1 intermediate1.mpg
ffmpeg -i input2.mp4 -qscale:v 1 intermediate2.mpg
cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
ffmpeg -i intermediate_all.mpg -qscale:v 2 output.mp4
Approach #2: Using ffmpeg concat demuxer along with timebase handling
Steps:
ffmpeg -i input1.mp4 -s hd720 -r 30000/1001 -video_track_timescale 30k -c:a copy input1-converted.mp4
ffmpeg -i input2.mp4 -s hd720 -r 30000/1001 -video_track_timescale 30k -c:a copy input2-converted.mp4
ffmpeg -f concat -safe 0 -i vidlist.txt -c copy output.mp4
References:
https://ffmpeg.org/faq.html#How-can-I-join-video-files_003f
How to concatenate two MP4 files using FFmpeg?
After merge videos, the duration is too long - ffmpeg
How to concatenate two MP4 files using FFmpeg?
Expectations:
One resultant clip with both inputs merged one after another with proper length(sum of inputs) and no video freeze/audio loss.
Results:
One resultant clip with both inputs merged one after another with lengthy duration(more than the sum of inputs) and video freeze and sometimes audio loss as well.
Your inputs must have the same parameters, but yours vary in width, frame rate, timescale, audio sample rate, and audio channel layout. Since input1.mp4 is the main feature you can re-encode input2.mp4 to match the properties of input1.mp4:
ffmpeg -i input2.mp4 -filter_complex "[0:v]pad=1280:720:-1:-1,fps=30000/1001[v];[0:a]aformat=sample_rates=44100:channel_layouts=stereo[a]" -map "[v]" -map "[a]" input2b.mp4
Then use the concat demuxer to concatenate them. Create input.txt:
file 'input1.mp4'
file 'input2b.mp4'
Concatenate:
ffmpeg -f concat -i input.txt -c copy output.mp4
This leaves input1.mp4 untouched: the process is faster, and preserves the quality of input1.mp4.
Even better is to re-create a new input2.mp4 from the original source while setting the proper parameters. This will avoid generation loss from re-encoding a new file from it.
try this
ffmpeg -i input1-converted.mp4 -i input2-converted.mp4 -filter_complex "concat=n=2:v=1:a=1" output.mp4
n=2 (inputs).
v=1: 1 video stream from each video.
a=1 1 audio stream from each video.

Transcode Webm to Audio file (fluent-ffmpeg)

I have a video file and its properties are as the following when I check via the ffprobe command;
My purpose is to take the audio file only and its size should not be >100mb.
Is there any proper way of doing it in an NPM project?
ffprobe 2.webm
ffprobe version N-86175-g64ea4d1 Copyright (c) 2007-2017 the FFmpeg
developers built with gcc 6.3.0 (GCC) configuration: --enable-gpl --
nable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2
--
nable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-
ontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --
nable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --
nable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-
ibmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-
ibopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-
ibsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-
ibtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --
nable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
ibx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --
nable-zlib libavutil 55. 63.100 / 55. 63.100 libavcodec 57.
96.101
7. 96.101
libavformat 57. 72.101 / 57. 72.101
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 90.100 / 6. 90.100
libswscale 4. 7.101 / 4. 7.101
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Input #0, matroska,webm, from '2.webm':
Metadata:
encoder : libwebm-0.2.1.0
creation_time : 2017-05-04T14:59:01.639000Z
Duration: 00:02:35.16, start: 0.000000, bitrate: 32 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Stream #0:1(eng): Video: vp8, yuv420p(progressive), 640x480, SAR 1:1 DAR
4:3, 14.99 tbr, 1k tbn, 1k tbc (default)
Using fluent-ffmpeg's API
You could use the noVideo() method which tells ffmpeg to produce output with "no video".
ffmpeg('/path/to/file.avi').noVideo();
Using ffmpeg's CLI API
I'm not sure of fluent-ffmpeg, but using ffmpeg, you would use the -map option to dictate what streams you want from you inputs in your output. So for your example, the command to get an MP3 file that contains only the first audio stream from your input would be:
ffmpeg -i 2.webm -map 0:a:0 out.mp3
Alternatively, you could tell ffmpeg to not include video streams using the -vn option; but I like to be explicit. Your command would then be:
ffmpeg -i 2.webm -vn out.mp3
You can also use the -acodec option to dictate what encoder you want to use such as AAC or whatever. ffmpeg will use the best guess by looking at the extension you gave your output if you don't give it enough options.
As to limiting filesize, I'm not sure of a clean way to do that, but this question on the Video Production StackExchange may help: How to limit file size with ffmpeg?. It suggests playing with your bitrate until you get the size you want. I would assume you could calculate correct bitrate ahead of time.

ffmpeg radio live transcoding mp3/aac to g722

I have tried to transcode a radio stream with ffmpeg to g722.
I get the stream to work and im able to listen to the stream.
The problem is that the output stream have faster speed than the input stream.
so the result is not good. I have tried to slow down the speed with atempo without any luck.
like:
size= 241kB time=00:00:28.67 bitrate= 68.8kbits/s speed= 1.4x
this varies from 1.x to 15.x
Console output:
c:\ffmpeg\bin>ffmpeg -i http://lyd.nrk.no/nrk_radio_mp3_mp3_l -ac 1 -acodec g722 -f rtp -ab 64k -ar 16k rtp://192.168.0.99:555
ffmpeg version N-85750-ga75ef15 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.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. 61.100 / 55. 61.100
libavcodec 57. 93.100 / 57. 93.100
libavformat 57. 72.101 / 57. 72.101
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 88.100 / 6. 88.100
libswscale 4. 7.101 / 4. 7.101
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Input #0, mp3, from 'http://lyd.nrk.no/nrk_radio_mp3_mp3_l':
Metadata:
icy-name : NRK mP3
icy-pub : 1
Duration: N/A, start: 0.000000, bitrate: 96 kb/s
Stream #0:0: Audio: mp3, 48000 Hz, stereo, s16p, 96 kb/s
[udp # 000000000244bec0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp # 00000000024781a0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
Stream mapping:
Stream #0:0 -> #0:0 (mp3 (native) -> adpcm_g722 (g722))
Press [q] to stop, [?] for help
Output #0, rtp, to 'rtp://192.168.0.99:555':
Metadata:
icy-name : NRK mP3
icy-pub : 1
encoder : Lavf57.72.101
Stream #0:0: Audio: adpcm_g722 (g722), 16000 Hz, mono, s16, 64 kb/s
Metadata:
encoder : Lavc57.93.100 g722
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 192.168.0.99
t=0 0
a=tool:libavformat 57.72.101
m=audio 555 RTP/AVP 9
b=AS:64
size= 413kB time=00:00:49.17 bitrate= 68.8kbits/s speed=1.43x
Does anyone know what im doing wrong?
Thanks
The problem is that the output stream have faster speed than the input stream
Are you sure about this? If so, the issue comes down to sample rate. The playback side (after FFmpeg) is playing back at a higher sample rate than what you're outputting from FFmpeg.
I suspect this isn't really happening though based on this comment:
this varies from 1.x to 15.x
When you connect to an internet radio stream, a large buffer is going to be flushed to you as fast as possible. This enables fast starts for players. For your FFmpeg command, it means that when you first connect, FFmpeg is also going to process this data as fast as possible and send it over. This is generally fine, provided that the end playback device is buffering data. If it isn't, you'll have to force FFmpeg to buffer data.
You can do that by specifying the -re parameter before the input. This will force the input to run in real time against a software-defined clock.

FFmpeg rtp streaming opus file problems

i have the next situation.
Have file on remote VPS server.
I want that this file (opus codec) can be accessible through RTP on my android phone.
I tried ffmpeg with next command:
ffmpeg -ar 44800 -i bon_jovi_loverboy.opus -acodec libopus -ac 1 -ab 96k -vn -f rtp rtp://127.0.0.1:5004 -loglevel 56
But got next error:
bon_jovi_loverboy.opus: Invalid data found when processing input
Full log:
root#cs82932:/home/rstream/rtstream/src# ffmpeg -ar 44800 -i bon_jovi_loverboy.opus -acodec libopus -ac 1 -ab 96k -vn -f rtp rtp://127.0.0.1:5004 -loglevel 56
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --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-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Splitting the commandline.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '44800'.
Reading option '-i' ... matched as input url with argument 'bon_jovi_loverboy.opus'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'libopus'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '1'.
Reading option '-ab' ... matched as option 'ab' (audio bitrate (please use -b:a)) with argument '96k'.
Reading option '-vn' ... matched as option 'vn' (disable video) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'rtp'.
Reading option 'rtp://127.0.0.1:5004' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '56'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument 56.
Successfully parsed a group of options.
Parsing a group of options: input url bon_jovi_loverboy.opus.
Applying option ar (set audio sampling rate (in Hz)) with argument 44800.
Successfully parsed a group of options.
Opening an input file: bon_jovi_loverboy.opus.
[AVIOContext # 0x965e60] Statistics: 36389 bytes read, 0 seeks
bon_jovi_loverboy.opus: Invalid data found when processing input
What wrong? Thanks
UPD
I update ffmpeg and streaming looks successfully.
ffmpeg -stream_loop -1 -i 4a6u7-ptl2w.opus -acodec libopus -ac 1 -ab
96k -vn -f rtp rtp://95.213.195.192:5004/f.opus
ffmpeg version 3.2.4-1~16.04.york1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.1 (Ubuntu 5.4.1-5ubuntu2~16.04.york1) 20170210
configuration: --prefix=/usr --extra-version='1~16.04.york1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --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 --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
Input #0, ogg, from '4a6u7-ptl2w.opus':
Duration: 00:02:34.21, start: 0.000000, bitrate: 69 kb/s
Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Metadata:
ENCODER : Lavc57.77.100 libopus
Output #0, rtp, to 'rtp://95.213.195.192:5004/f.opus':
Metadata:
encoder : Lavf57.56.101
Stream #0:0: Audio: opus (libopus), 48000 Hz, mono, flt, 96 kb/s
Metadata:
encoder : Lavc57.64.101 libopus
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 95.213.195.192
t=0 0
a=tool:libavformat 57.56.101
m=audio 5004 RTP/AVP 97
b=AS:96
a=rtpmap:97 opus/48000/2
Stream mapping:
Stream #0:0 -> #0:0 (opus (native) -> opus (libopus))
Press [q] to stop, [?] for help
size= 44893kB time=00:52:18.12 bitrate= 117.2kbits/s speed=56.5x
But when i try to connect by rtp from local PC (VLC Player) i get the exception:
core error: socket bind error: Cannot assign requested address
core error: open of `rtp://95.213.195.192:5004/f.opus' failed
When i try ffplay on remote pc (same where ffmpeg):
ffplay rtp://95.213.195.192:5004/f.opus
ffplay version 3.2.4-1~16.04.york1 Copyright (c) 2003-2017 the FFmpeg developers
built with gcc 5.4.1 (Ubuntu 5.4.1-5ubuntu2~16.04.york1) 20170210
configuration: --prefix=/usr --extra-version='1~16.04.york1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --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 --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
Segmentation fault
Can you help me? Thanks
95.213.195.192 - IP of my remote server with file

Resources