I am trying to stream h265 video to aws s3 from ffmpeg, here is the command that i use:
ffmpeg -f gdigrab -i desktop -r 1 -vframes 5 -c:v libx265 -crf 40 -f mp4 pipe:1 | aws s3 cp - s3://videosbuket-009212/d5.mp4
and error information:
[mp4 # 000001c49541bb40] muxer does not support non seekable output
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
what's wrong here?
What’s wrong is that mp4 does not support non seekable output. Just like the error reads. Use a format that doesn’t not requires seeking, like mkv. If you require mp4, then you must make a local copy first.
Related
I am working on an electron app that uses ffmpeg, I am developing on a win10 machine so I am using command prompt and I have installed the npm package 'ffmpeg-ffprobe-static'. I can run ffmpeg commands in the terminal by calling the package like so:
C:\Users\martin\myproject\node_modules\ffmpeg-ffprobe-static>ffmpeg.exe -h
ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200621
....
I have an ffmpeg command to combine two flac files into a single mp3 file that has been working fine until I encountered this error:
[mjpeg # 0000022537ace640] bits 85 is invalid
Error while decoding stream #0:1: Invalid data found when processing input
Too many packets buffered for output stream 0:0.
[libmp3lame # 0000022537ac3480] 3 frames left in the queue on closing
Conversion failed!
The same command works for other flac files, so there's something about these Billy Martin songs that can be played perfectly fine in vlc but cause ffmpeg to crash:
//running this command:
ffmpeg.exe -i "G:\RenderTune broken files\broken flac example\05 - Billy Martin - Phillie Dog.flac" -i "G:\RenderTune broken files\broken flac example\08 - Billy Martin - Stax.flac" -y -filter_complex concat=n=2:v=0:a=1 -c:a libmp3lame -b:a 320k "G:\RenderTune broken files\broken flac example\COMBINED_FILES.mp3"
//results in this output:
[mjpeg # 0000022537ace640] bits 85 is invalid
Error while decoding stream #0:1: Invalid data found when processing input
Too many packets buffered for output stream 0:0.
[libmp3lame # 0000022537ac3480] 3 frames left in the queue on closing
Conversion failed!
I uploaded the broken flac files here: https://www.mediafire.com/folder/0v9hbfrap727y/broken+flac
If I run this same command with other flac files it works fine:
ffmpeg.exe -i "G:\RenderTune broken files\working flac example\5. Gossip.flac" -i "G:\RenderTune broken files\working flac example\6. Let The Children Play.flac" -y -filter_complex concat=n=2:v=0:a=1 -c:a libmp3lame -b:a 320k "G:\RenderTune broken files\working flac example\COMBINED_FILES.mp3"
I have tried adding -max_muxing_queue_size 9999 to my ffmpeg command like many posts suggest but that does not fix it, does anybody know how to prevent this error?
[edit]
I tried one of the posted solutions:
ffmpeg.exe -y -i "G:\RenderTune broken files\working flac example\5. Gossip.flac" -i "G:\RenderTune broken files\working flac example\6. Let The Children Play.flac" -filter_complex "[0:a][1:a]concat=n=2:v=0:a=1[a]" -map "[a]" -c:a libmp3lame -b:a 320k "G:\RenderTune broken files\working flac example\COMBINED_FILES.mp3"
which crashed with a different error:
[libmp3lame # 000002453725f3c0] Queue input is backward in time.9x
... lots of these [mp3 # ..] messages
[mp3 # 0000024537344400] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 2449071 >= 2445999
[mp3 # 0000024537344400] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 2449071 >= 2447151
[mp3 # 0000024537344400] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 2449071 >= 2448303
[flac # 00000245372d4140] invalid residual315.7kbits/s speed=59.7x
[flac # 00000245372d4140] decode_frame() failed
Error while decoding stream #1:0: Invalid data found when processing input
size= 24871kB time=00:10:37.09 bitrate= 319.8kbits/s speed=60.5x
video:0kB audio:24869kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.004673%
Something is wrong involving the album art image. Ignore it by adding an output label to your concat filter output and only mapping the concatenated audio:
ffmpeg.exe -y -i "G:\RenderTune broken files\working flac example\5. Gossip.flac" -i "G:\RenderTune broken files\working flac example\6. Let The Children Play.flac" -filter_complex "[0:a][1:a]concat=n=2:v=0:a=1[a]" -map "[a]" -c:a libmp3lame -b:a 320k "G:\RenderTune broken files\working flac example\COMBINED_FILES.mp3"
Otherwise the default stream selection will choose the filter output plus the broken image causing the error shown in your question.
This solved the problem to me (afterwards says about broken flags but this is easily fixed by recodening again or by playing with settings).
Linux 21.04, ffmpeg
ffmpeg version 4.2.3
File example: here (for few days)
ffmpeg -fflags +genpts -i peta_alien.ogv -map 0 -c:v copy -c:a aac -max_muxing_queue_size 4000 peta_alien.avi
I just want to upload a video file to AWS S3 using ffmpeg console. I tried
ffmpeg -re -i 1.mp4 -f hls -method PUT https://[my-public-bucket].s3.us-east-2.amazonaws.com/video/temp.mp4
the commands executes but no file appears in the bucket.
Also I tried
ffmpeg -re -i 1.mp4 -f mp4 -movflags frag_keyframe+empty_moov -method PUT https://[my-public-bucket].s3.us-east-2.amazonaws.com/video/temp.mp4
but got an error:
[tls # 00000295dffdea80] Error in the push function.
frame= 201 fps= 15 q=-1.0 Lsize= 33kB time=00:00:13.44 bitrate= 20.2kbits/s speed=0.984x
video:27kB audio:212kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[tls # 00000295dffdea80] The specified session has been invalidated for some reason.
[tls # 00000295dffdea80] Error in the pull function.
[https # 00000295dffde980] URL read error: I/O error
My another task is to upload a video to S3 using Presigned Url of my private bycket. I tried:
ffmpeg -re -i 1.mp4 -f mp4 -movflags frag_keyframe+empty_moov -method PUT [my-presigned-url]
and it fails with the same error.
Does anyone know how to upload the video to S3 ?
I'm using ffmpeg to push raspberrypi video feeds (CSI camera) to a nginx-RTMP server then the nginx push it to youtube.
My problem is, every time when I run the ffmpeg command, it always gives me input/out error. Then it is working fine when I run the exact same ffmpeg command for the 2nd time.
How do I resolve this problem?
I want to start the ffmpeg command in a script file and put the script in crontab so that it can start the live streaming automatically. But this error makes it impossible to do that.
my ffmpeg command is as below(change the real domain name to mydomain.com):
ffmpeg -thread_queue_size 512 -f v4l2 -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -input_format yuyv422 -video_size 1280x720 -framerate 30 -i /dev/video0 -vf eq=gamma=1.5:saturation=1.3 -c:v h264_omx -b:v 20480K -vsync 1 -g 16 -f flv rtmp://mydomain.com:1935/live/
the error log:
Input #1, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 474200.421802, bitrate: 442368 kb/s
Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 442368 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
rtmp://rtmp.simonliu.space:1935/live/: Input/output error
I use avconv on ubuntu,I found this command
avconv -f alsa -i pulse -f x11grab -r 25 -s 1280x720 -i :0.0+0,0 -acodec libfaac -vcodec libx264 -pre:0 lossless_ultrafast -threads 0 video.mkv
to save as a file, and this command
avconv -i ./test.m4v -re -c copy -f flv "rtmp://localhost/livestream"
to push live stream.
How can I combine them together?
Firstly, you should ask such questions on video.stackexchange.com and not here.
Secondly, let's take apart the two commands that you have found:
-f alsa - format for the input is alsa
-i pulse - you are reading pulse (the pulseaudio driver)
-f x11grab - planning to read from the screen on x11
-r 25 -s 1280x720 - rate and size of the incoming video stream
-i :0.0+0,0 - this selects where the incoming video comes from
-acodec libfaac - here the output options start, you're setting audio code to libfaac, or at least trying to... since this option has been deprecated long time ago, currently -c:a would be used
-vcodec libx264 - setting video code, except that you should be using -c:v
-pre:0 lossless_ultrafast -threads 0 - some sort of parameters about how encoding should be done
video.mkv - this is the output file
And the second one
-i ./test.m4v - the file you're reading
-re - "Read input at native frame rate"
-c copy - do not reencode, but simply pipe as is
-f flv - the container format
"rtmp://localhost/livestream" - where you're planning to write all that.
When you understand that, it should be clear that what you are planning to do is to use the input and encoding part from the first command, and the format and output from the second one.
Here i didn't have time to check that everything that you found is working, you should do that yourself.
I'm trying to get a simple local preview of my webcam from an FFMpeg udp stream using an embedded Mplayer window. I can view the live stream using MPlayer but the image is unstable. I'm using the following FFMpeg command:
ffmpeg -f dshow -video_size 640x480 -i video="Lenovo EasyCamera" -an -f rawvideo -pix_fmt yuyv422 -r 15 udp://127.0.0.1:1234
And this is the MPlayer command:
mplayer -demuxer rawvideo -rawvideo fps=15:w=640:h=480:format=yuy2 -nofs -noquiet -identify -idle -slave -nomouseinput -framedrop -wid 1051072
Sometimes the stream image is OK, but intermittently the image tears randomly and this is how it looks (sorry, not enough rep for images in posts)
http://imgur.com/sLC3FW0
I have tried with FFPlay to see if it's a problem with MPlayer, but I get the same result:
ffplay -s 640x480 -pix_fmt yuyv422 -f rawvideo -i udp://127.0.0.1:1234
http://imgur.com/06L42Cj
This effect is happening at random. If I stop and restart the video might be OK, or it may look like the above. Using aything other than udp and rawvideo adds a delay to the video stream, which I want to avoid.
The FFMpeg streaming guide suggest methods when you get packet loss, but as far as I'm aware I don't seem to be getting that.
I'm new to FFMpeg/Mplayer/video streaming and any help or thoughts greatly appreciated.