Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors out when streaming mp4 #39

Closed
shkr opened this issue Jul 16, 2020 · 3 comments
Closed

Errors out when streaming mp4 #39

shkr opened this issue Jul 16, 2020 · 3 comments
Labels
question Further information is requested

Comments

@shkr
Copy link

shkr commented Jul 16, 2020

Commands to recreate

docker run --rm -it -v $PWD/rtsp-simple-server.yml:/rtsp-simple-server.yaml -p 8554:8554 aler9/rtsp-simple-server
shkr@Blade:~/Documents/repos/rtsp_server/rtsp-rtp-stream/data$ ffmpeg -framerate 1 -i /dev/video0 -f rtsp rtsp://127.0.0.1:8554/mystream
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-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
[video4linux2,v4l2 @ 0x5563f5fd8900] The driver changed the time per frame from 1/1 to 1/10
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 58202.087847, bitrate: 147456 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 147456 kb/s, 10 fps, 10 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, rtsp, to 'rtsp://127.0.0.1:8554/mystream':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: mpeg4, yuv420p, 1280x720, q=2-31, 200 kb/s, 10 fps, 90k tbn, 10 tbc
    Metadata:
      encoder         : Lavc57.107.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
av_interleaved_write_frame(): Broken pipe00:00:14.60 bitrate=N/A dup=1 drop=0 speed=0.994x    
frame=  151 fps= 10 q=19.5 Lsize=N/A time=00:00:15.00 bitrate=N/A dup=1 drop=0 speed=0.998x    
video:595kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
shkr@Blade:~/Documents/repos/rtsp_server/rtsp-rtp-stream/data$ 
# supported stream protocols (the handshake is always performed with TCP)
protocols: [tcp]
# port of the TCP RTSP listener
rtspPort: 8554
# port of the UDP RTP listener
rtpPort: 8000
# port of the UDP RTCP listener
rtcpPort: 8001
# command to run when a client connects.
# this is terminated with SIGINT when a client disconnects.
runOnConnect:
# timeout of read operations
readTimeout: 5s
# timeout of write operations
writeTimeout: 5s
# time after which a stream is considered dead
streamDeadAfter: 15s
# supported authentication methods
authMethods: [basic, digest]
# enable pprof on port 9999 to monitor performance
pprof: false

# these settings are path-dependent. The settings under the path 'all' are
# applied to all paths that do not match a specific entry.
paths:
  all:
    # source of the stream - this can be:
    # * record -> the stream is provided by a client through the RECORD command (like ffmpeg)
    # * rtsp://original-url -> the stream is pulled from another RTSP server
    source: record
    # if the source is an RTSP url, this is the protocol that will be used to pull the stream
    sourceProtocol: udp

    # username required to publish
    publishUser:
    # password required to publish
    publishPass:
    # IPs or networks (x.x.x.x/24) allowed to publish
    publishIps: []

    # username required to read
    readUser:
    # password required to read
    readPass:
    # IPs or networks (x.x.x.x/24) allowed to read
    readIps: []

    # command to run when a client starts publishing.
    # This is terminated with SIGINT when a client stops publishing.
    runOnPublish:

    # command to run when a clients starts reading.
    # This is terminated with SIGINT when a client stops reading.
    runOnRead:

Please help. Just share instructions on how to push mp4 file as rtsp stream using docker

@aler9 aler9 added the question Further information is requested label Jul 19, 2020
@aler9
Copy link
Member

aler9 commented Jul 19, 2020

Hello,

  • You're using rtsp-simple-server in TCP mode, why? just use the normal UDP mode with this command

    docker run --rm -it --network=host aler9/rtsp-simple-server
    

    or use TCP mode by fixing your command (you wrote .yaml instead of .yml)

    docker run --rm -it -v $PWD/rtsp-simple-server.yml:/rtsp-simple-server.yml -p 8554:8554 aler9/rtsp-simple-server
    
  • You're asking about streaming MP4s, but you posted a command that is intended to stream the webcam. To stream the webcam, use

    ffmpeg -f v4l2 -i /dev/video0 -f rtsp rtsp://localhost:8554/mystream
    

Anyway, i think that your error depends on the fact that you're trying to push a UDP stream into a Docker container, which do not work for the reasons exposed in the README. Just use rtsp-simple-server in UDP mode with the command i provided above and it will work. Otherwise, push in TCP mode with

ffmpeg -f v4l2 -i /dev/video0 -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mystream

@shkr
Copy link
Author

shkr commented Aug 5, 2020

Thanks.

Now I am running

docker run --rm -it -v $PWD/rtsp-simple-server.yml:/rtsp-simple-server.yml -p 8554:8554 aler9/rtsp-simple-server

and

ffmpeg -f v4l2 -i /dev/video0 -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mystream

Both commands are working fine.

How can I view the output rtsp url? Can you share a working command for that.

@shkr
Copy link
Author

shkr commented Aug 5, 2020

This is the error if I try to read the output rtsp stream to an mp4 using ffmpeg

shkr@Blade:~/Documents/repos/rtsp_server$ 
shkr@Blade:~/Documents/repos/rtsp_server$ ffmpeg -i rtsp://localhost:8554/mystream -c copy output.mp4
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --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
[rtsp @ 0x55b52026e8c0] method SETUP failed: 461 Unsupported Transport
rtsp://localhost:8554/mystream: Invalid data found when processing input

@aler9 aler9 closed this as completed Mar 30, 2021
@bluenviron bluenviron locked and limited conversation to collaborators Mar 30, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants