
Recherche avancée
Médias (2)
-
Granite de l’Aber Ildut
9 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
Géodiversité
9 septembre 2011, par ,
Mis à jour : Août 2018
Langue : français
Type : Texte
Sur d’autres sites (1907)
-
Is it possible to encode an audio stream with the exact length (to millisecond) ?
27 avril 2019, par v010dyaI am looking to create an output file with a length exactly 30 seconds in either mp3, aac, or vorbis codecs. I have used avconv (and also tried ffmpeg) with the following command :
avconv -i input_file_here -c:a aac -b:a 320k -t 30 out.mp4
This produces the output, stating that it has encoded exactly 30 seconds, but then :
$ avprobe out.mp4
avprobe version v13_dev0-1648-gc4642788e, Copyright (c) 2007-2018 the Libav developers
built on Apr 24 2019 15:49:35 with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf57.83.100
Duration: 00:00:30.02, start: 0.023220, bitrate: 323 kb/s
Stream #0:0(und): Audio: aac (LC) [mp4a / 0x6134706D]
44100 Hz, stereo, fltp, 321 kb/s (default)
Metadata:
handler_name : SoundHandler
# avprobe outputWhen i encode in mp3 it correctly displays that it does more than 30 seconds during the encoding. When i try vorbis it does slightly less than 30 seconds.
Is it possible to achieve the length of 30 seconds to the millisecond using any tool (i prefer either avconv).
-
av_interleaved_write_frame() : Connection reset by peer - Using ffmpeg connected to local nginx
10 avril 2019, par haxporI have a local nginx web server installed with nginx-rtmp-module.
I have 2 RTMP sources that are fed into local network at
rtmp://127.0.0.1/live-video
, andrtmp://127.0.0.1/live-audio
. Then these twos will be combined and fed intortmp://127.0.0.1/live
again. The latter one will be the one that I will be using.The reason I did just that is I want to do noise reduction via
sox
.The setup is as follows
-
rtmp://127.0.0.1/live-video
- it usesffmpeg
to capture only screen (video) then output to such URL with commandffmpeg -analyzeduration 0 -video_size 1280x1080 -framerate 25 -f x11grab -i :0.0 -vcodec libx264 -flags +global_header -preset ultrafast -minrate 7200 -maxrate 8k -vsync 1 -f flv -metadata streamName=ZombieHeroLiveStream rtmp://127.0.0.1/live-video
-
rtmp://127.0.0.1/live-audio
- it usessox
to do noise reduction then usesffmpeg
to feed into such URL with commandffmpeg -f alsa -ac 1 -i default -preset ultrafast -f flac - | sox - -p noisered /tmp/noise.prof 0.21 | ffmpeg -analyzeduration 0 -thread_queue_size 2 -i - -f flv -preset ultrafast rtmp://127.0.0.1/live-audio
-
rtmp://127.0.0.1/live
- it usesffmpeg
to combine the above two sources then output into such URL, this is the one I tested viewing via VLC (which is works fine) with commandffmpeg -analyzeduration 0 -thread_queue_size 512 -rtmp_live live -flags +global_header -i "rtmp://127.0.0.1/live-video" -analyzeduration 0 -thread_queue_size 512 -rtmp_live live -flags +global_header -i "rtmp://127.0.0.1/live-audio" -c:v copy -c:a copy -map 0:v -map 1:a -async 1 -vsync 1 -video_size 1280x1080 -fflags +genpts -framerate 30 -preset ultrafast -minrate 7200 -maxrate 8k -flags +global_header -segment_list_flags +live -rtmp_live live -f flv -metadata streamName=ZombieHeroLiveStream "rtmp://127.0.0.1/live"
The setup works fine, I tested and confirmed viewing via VLC targeting to URL of 3. The problem is that for some times after all threes above up and running, 1. will exit and thus make the whole encoding stop. The error shown is
av_interleaved_write_frame(): Connection reset by peer29.88 bitrate=2021.8kbits/s dup=1791 drop=0 speed=0.998x
Last message repeated 2 times
...
Error writing trailer of rtmp://127.0.0.1/live-video: Connection reset by peerNo matter how I change and modify command line’s flags/options, it will end up like error above. Please note, I’ve modified flags quite a lot thus a certain flags might be possibly not needed.
Full error log from 1. is here.
Configuration of nginx server is here. It’s pretty much basic, but I will further use it to relay to multiple target RTMP servers later.
I’m on Ubuntu 18.04, 4.18.0-17-generic with 8 GB of RAM, 4 CPU Cores with ffmpeg
ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3), and with Nginx
nginx version: nginx/1.14.2
built by gcc 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)
built with OpenSSL 1.1.0g 2 Nov 2017 (running with OpenSSL 1.1.1b 26 Feb 2019)
TLS SNI support enabled
configure arguments: --with-http_ssl_module --add-module=../nginx-rtmp-module-1.2.1So again the question is how can I fix such issue ?
Any suggestion would be appreciated.Important edit : I just found out I entered a wrong duplicated command for 3. Now it has been corrected ! Sorry about that.
Update : I’m able to record audio with ffmpeg then do noise filter with sox, then stream to target rtmp with ffmpeg. But noise reduction doesn’t satisfy me yet. See above at 2. for its updated command. And according to this, sox has problem in understand a few bytes so I use flac format in piping instead. Still my question remained as this update is for improvement for command in 2.
-
-
ffmpeg undefined references on multiple functions
3 mai 2019, par GodsppedI am trying to compile an application that is using ffmpeg on Ubuntu and I am running into the following errors.
undefined reference to `av_write_image_line2'
undefined reference to `av_hwframe_transfer_data'
undefined reference to `av_hwdevice_get_hwframe_constraints'
undefined reference to `av_hwframe_get_buffer'
undefined reference to `av_hwdevice_ctx_create_derived'
undefined reference to `xcb_xfixes_get_cursor_image_cursor_image'
undefined reference to `xcb_xfixes_query_version'
undefined reference to `avpriv_slicethread_execute'
undefined reference to `avcodec_parameters_to_context'
undefined reference to `xcb_xfixes_get_cursor_image_reply'
undefined reference to `av_hwdevice_find_type_by_name'
undefined reference to `av_hwframe_map'
undefined reference to `av_spherical_tile_bounds'
undefined reference to `av_malloc_array'
undefined reference to `av_hwframe_transfer_get_formats'
undefined reference to `av_hwframe_ctx_alloc'
undefined reference to `xcb_shape_rectangles'
undefined reference to `av_stereo3d_type_name'
undefined reference to `avpriv_slicethread_free'
undefined reference to `avpriv_slicethread_create'
undefined reference to `xcb_xfixes_get_cursor_image'
undefined reference to `av_hwframe_ctx_init'
undefined reference to `avpriv_register_devices'
undefined reference to `av_hwframe_constraints_free'
undefined reference to `av_audio_fifo_peek_at'
undefined reference to `av_get_extended_channel_layout'
undefined reference to `av_hwframe_ctx_create_derived'
undefined reference to `xcb_xfixes_query_version_reply'
undefined reference to `av_mallocz_array'
undefined reference to `av_read_image_line2'The version of ffmpeg I have :
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
configuration: --enable-pic --pkg-config-flags=--static --extra-libs='-lpthread -lm'
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.100In my makefile I have added -lavutil -lavcodec -lavdevice -lavfilter -lavformat -lswresample -lswscale to my link step.
What am I doing wrong ? Are these deprecated in the version of ffmpeg I have ?