[FFmpeg-user] ffmpeg to stream an already h.264 encoded stream

Verachten Bruno gounthar at gmail.com
Fri Sep 13 10:58:27 EEST 2019


As for the filename, I used a bash variable, and it worked. I should have
thought about it earlier.
I haven't found yet how to keep the bitrate and size, and still have to add
delay for the sound.

I tried to play back the file on another machine (Windows this time), and
it doesn't work.
It stays on the first part of the video, ignoring the rest, and giving
errors when trying to fast forward:
 ./ffmpeg-20181106-d96ae9d-win64-static/bin/ffplay.exe
third-HDMI-input-20190912.182417486.mkv
ffplay version N-94455-g01994c93db Copyright (c) 2003-2019 the FFmpeg
developers
  built with gcc 9.1.1 (GCC) 20190716
  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. 33.100 / 56. 33.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, flv, from 'third-HDMI-input-20190912.182417486.mkv':
  Metadata:
    encoder         : Lavf58.29.100
  Duration: 00:00:00.00, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 100
tbr, 1k tbn
    Stream #0:1: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s
SDL_OpenAudio (2 channels, 48000 Hz): WASAPI can't initialize audio client:
CoInitialize n’a pas été appelé.

SDL_OpenAudio (1 channels, 48000 Hz): WASAPI can't initialize audio client:
CoInitialize n’a pas été appelé.

SDL_OpenAudio (2 channels, 44100 Hz): WASAPI can't initialize audio client:
CoInitialize n’a pas été appelé.

SDL_OpenAudio (1 channels, 44100 Hz): WASAPI can't initialize audio client:
CoInitialize n’a pas été appelé.

No more combinations to try, audio open failed
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0   B f=0/0
   f=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
third-HDMI-input-20190912.182417486.mkv: error while seekingf=0/0
 673.85 M-V:  0.000 fd= 225 aq=    0KB vq=    0KB sq=    0B f=0/0

Bruno

On Thu, Sep 12, 2019 at 10:31 AM Verachten Bruno <gounthar at gmail.com> wrote:

> Thanks a lot Moritz, that did the trick.
> So I now have:
> ffmpeg -i "$SOURCE" -thread_queue_size 2048 -f pulse -i "$AUDIO_SOURCE"
> -c:v copy -map 0:v:0 -map 1:a:0 -c:a libmp3lame -f tee
> "[f=flv:onfail=ignore]$YOUTUBE_URL/$KEY|[f=flv:onfail=ignore]local_file.mkv"
> which gives
> Output #0, tee, to '[f=flv:onfail=ignore]rtmp://
> a.rtmp.youtube.com/live2/my-key|[f=flv:onfail=ignore]local_file.mkv
> <http://a.rtmp.youtube.com/live2/my-key%7C%5Bf=flv:onfail=ignore%5Dlocal_file.mkv>
> ':
>
> The output file is created, and the stream on YouTube is working too. I
> don't know if MKV is the best format to use in this case.
>
> I still have to figure out how to create a filename with a timestamp in
> it. I had a look at the strftime option, but I don't know how to insert
> it into the tee parameters.
>
> I have another problem now, which is that the bitrate and the size have
> disappeared:
> frame= 4491 fps= 29 q=-1.0 size=N/A time=00:02:34.16 bitrate=N/A
> speed=0.999x
> I guess it's because of the tee. Is there any way to put them back on? It
> was useful to check the streaming was going ok.
>
> On Tue, Sep 10, 2019 at 10:03 PM Moritz Barsnick <barsnick at gmx.net> wrote:
>
>> On Tue, Sep 10, 2019 at 17:25:43 +0200, Verachten Bruno wrote:
>> > ffmpeg -i rtmp://192.168.1.212:1935/live/stream1 -thread_queue_size
>> > 2048 -f pulse -i
>> > alsa_input.usb-Focusrite_Scarlett_2i4_USB-00.analog-stereo -c:v copy
>> > -map 0:v:0 -map 1:a:0 -f tee "[f=flv:onfail=ignore]$YOUTUBE_URL/$KEY"
>> [...]
>> > Automatic encoder selection failed for output stream #0:1. Default
>> > encoder for format tee (codec none) is probably disabled. Please
>> > choose an encoder manually.
>> > Error selecting an encoder for stream 0:1
>> >
>> > I had other outputs for the tee, but as it was not working, I removed
>> > them. There must be something important that I missed in that tee
>> > format...
>> > Please let me know.
>>
>> Yes, you missed the actual error message. ;-)
>>
>> The tee muxer, unlike the flv muxer, doesn't have useful defaults for
>> codecs. You are only specifying the video codec ("-c:v copy"), you also
>> need to specify an audio codec. AFAICT, flv defaults to mp3, so if you
>> want that, you should add "-c:a libmp3lame" to your command line.
>>
>> Hope this helps,
>> Moritz
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
>
>
> --
> Bruno Verachten
>


-- 
Bruno Verachten


More information about the ffmpeg-user mailing list