I'm trying to encode video files, that users upload on my server.
I interpretate file as stream, incoming on my server by http protocol and use ffmpeg for realtime file encoding, while upload procedure executes.
When source file have .avi format, I have successful encoding result, but on .mp4 format appears error:
---------------------
[buffer # 0000000000308380] Unable to parse option value "-1" as pixel format
Last message repeated 1 times
[buffer # 0000000000308380] Error setting option pix_fmt to value -1.
---------------------
I think this might be because .mp4 contains "moov atom" data in the end of file.
I think so because when I processing file by "-movflags faststart" command before encoding, I also have successful result.
That is the command i using now:
ffmpeg -i http://myhost.com/app/video/video2.mp4 -f mp4 -vcodec libx264 -b:v 800K -acodec libvo_aacenc -b:a 128K -ar 44100 -ac 2 -y c:/watch-and-get/video/video5.mp4
Can I resolve this problem and encode multiple video formats as a stream without any excess steps?
you are running an old version of ffmpeg. this problem was fixed.
-pix_fmt is pixel format and its value should be an integer.(ffmpeg somehow takes this value as -1, i am not sure why. hence u get that error. but updating would solve this problem)
extra info : run ffmpeg -pix_fmts to see the all the available pixel formats.
download the latest version.
i would recommend installing the latest version from a binary as it is much simpler. i have answered about the same here
Related
Hello everyone For almost a whole month now I have been trying to download a file from a specific site
This is the link to the video
https://www.karaoke.co.il/api_play.php?type=clip&id=58370&autoplay=undefined&referer=karaoketv
The M3u8 files are split into 2 parts.
Video file
https://www.video-cdn.com/video/encrypt/750802ea0bc2d02fac93adeaa1398ec2/750802ea0bc2d...2-57d9518fae69
And an audio file
https://www.video-cdn.com/video/encrypt/750802ea0bc2d02fac93adeaa1398ec2/750802ea0bc2d...2-57d9518fae69
As far as I know there is a Key that needs to be entered in order to download the file.
And when I run the command in ffmpeg
I encounter many errors like:
Unable to open key file
Anyone who can download it.
I would be very happy if he would write me a code that works and explain to me how to do it
These are all the codes I have already tried
ffmpeg -decryption_key https://www.video-cdn.com/video/key/750802ea0bc2d02fac93adeaa13cde64 -i https://www.video-cdn.com/video/encrypt/750802ea0bc2d02fac93adeaa1398ec2/750802ea0bc2d02fac93adeaa1398ec2/video_720p.m3u8?token=R915dD-72351a7c-3dd1-4e58-b6c2-9cc813eeb183 -vcodec libx264 {output_file}
ffmpeg -decryption_key {key} -i {file} -max_muxing_queue_size 9999 d.mp4
ffmpeg -allowed_extensions ALL -protocol_whitelist data, file, http, https, tcp, tls, crypto -i "https://www.video-cdn.com/video/encrypt/f242d2da41d03b3955fb866efc5dbd59/f242d2da41d03b3955fb866efc5dbd59/video_720p.m3u8?token=R915dD-a1430cfc-0bda-46a0-a7e9-b15308875dc7" c copy -bsf: a aac_adtstoasc test.mp4 -decryption_key C:\ ffmpeg\enc.key
hlsdl -K "1a9625fb34a4afe0d5446138e9543563" https://www.video-cdn.com/video/encrypt/f242d2da41d03b3955fb866efc5dbd59/f242d2da41d03b3955fb866efc5dbd59/video_720p.m3u8?token=R915dD-be07b7e6-08aa-441b-afbd-5c7876409878
enter image description here
key:
base64:zPfjh0/g09EKjPIS4w37Kg==
Hex:ccf7e3874fe0d3d10a8cf212e30dfb2a
ffmpeg -decryption_key "https://www.video-cdn.com/video/key/750802ea0bc2d02fac93adeaa13cde64" -i "https://www.video-cdn.com/video/encrypt/750802ea0bc2d02fac93adeaa1398ec2/750802ea0bc2d02fac93adeaa1398ec2/video_720p.m3u8?token=R915dD-72351a7c-3dd1-4e58-b6c2-9cc813eeb183" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 file.mp4
I am trying to Convert the *.rtpdump file, created by Wireshark into wav file by Sox.
In Wireshark the original file is played without any tatering sound in the audio file, but when I convert it to wav file via SOX (on Windows), there is continuous tatering sound throughout the clip and the actual voice remains in background.
I tried the u-law encoding, a-law and others, the best it can get is with u-law, but it's also not so much audible. I tried the lowpass, gain, treble things but that also is not helping, changing channels, bit rate and other options make it worse.
Tried many things but tatering is not going
sox.exe -t raw -r 8000 -e u-law -c 1 66.rtpdump -t wav d:\out.wav -V
sox.exe -t raw -r 8000 -e a-law -c 1 66.rtpdump -t wav d:\out.wav -V
The first few bytes within each packet are causing this tatering sound.
I removed these bytes and the combined all the packets without these bytes to create a tatering free sound.
So, I've read all the articles here and unfortunately I can't seem to find the answers I'm looking for. I've gotten close, but the certain magic strings allude me.
I'm running hls live streaming (nginx) on ubuntu 17.10 server. In short, I can get the server running one video at a time fine with ffmpeg (with subtitles) using the following:
ffmpeg -re -i "1.mkv" -vcodec libx264 -vprofile baseline -g 30 -b:v 1000k -s 852x480 -acodec aac -strict -2 -b:a 192k -ac 2 -vf subtitles=1.srt -f flv rtmp://localhost:1935/show/stream
Though, I cannot find a solution to run a playlist using this method. It seems impossible, and when I try vlc via sout (internally, or externally) I reveive either buffer problems, or the aac experimental codec error:
[aac # 0xb162e900] The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
Example string that spits that error:
vlc "1.mkv" --sout '#transcode{soverlay,vb=1000,vcodec=h264,width=853,height=480,acodec=mp4a,ab=128,channels=2,samplerate=44100}:std{access=rtmp,mux=ffmpeg{mux=flv},dst=rtmp://localhost:1935/show/stream}'
Every other audio codec doesn't work with flv. I'm at a loss, I've tried almost every combination I could think of and digout just to get to this point. The best functioning out of them has been ffmpeg: it doesn't buffer video at all, plays smoothly, but just can't play a playlist. Whereas vlc can play a playlist but buffers, and has no sound (internally). I've tried aenc=ffmpeg{strict=-2}, batch pipes, etc, etc. I need help. Nothing works. Is there any solution? All I want is to run a playlist of 25 videos, all different variations, on a loop to the m3u8 for embedding.
A friend of mine mentioned he used bash scripts to have a seamless playlist like viewing feature. Hopefully that points you in the direction you need. I can try digging them up if you want to work together on this, coz I too am interested in finding out more about it.
I'm trying to create a fairly simple streaming server/site. Here's the current flow:
OBS streams to an RTMP URL
Nginx accepts the RTMP stream and uses exec-push to have FFmpeg pick up the stream and transcode it
FFmpeg transcodes the stream and outputs it to a JSMpeg application, which displays the stream on a webpage.
When I have my exec_push statement as follows, everything seems to work perfectly, except the browser says Possible garbage data. Skipping. on every frame it receives:
exec_push /usr/bin/ffmpeg -re -i rtmp://127.0.0.1:1935/$app/$name -f mpeg1video http://localhost:8080/supersecret;
This behavior is understandable, because JSMpeg must receive MPEG-TS data, not MPEG1 data. It sees the MPEG1 frames and thinks they're garbage.
So through some online research, I found this:
exec_push /usr/bin/ffmpeg -re -i rtmp://127.0.0.1:1935/$app/$name -c:v copy -c:a copy -f mpegts http://localhost:8080/supersecret;
Supposedly, this is supposed to transcode my RTMP stream into an MPEG-TS format, which should be compatible with JSMpeg.
However, with the second version of the command, my FFmpeg -> JSMpeg stream keeps connecting and disconnecting, connecting and disconnecting, and so on. This behavior is observed in terminal:
Stream Connected: ::1:40208
close
Stream Connected: ::1:40212
close
Stream Connected: ::1:40216
close
Stream Connected: ::1:40220
close
Stream Connected: ::1:40224
close
...
What would cause this? I am pretty certain the issue is in my exec_push command. OBS is perfectly content, which tells me that the stream is making it to the server, and if I do a push, I can do a test push to Ustream just fine, which tells me that Nginx is at least processing the stream with some reasonable degree of success.
Disclaimer: I have no idea what I'm talking about. Everything I know about FFmpeg and JSMpeg/Node is from snippets of code that I found online.
Answer credit goes to #Mulvya.
In the second exec_push command, the -c:v copy -c:a copy should not be there. By using that, there isn't any transcoding going on-- it's just a stream passthrough.
Removing the -c:v copy -c:a copy from the command and restarting Nginx yields a successful stream.
I'm currently doing a stream that is supposed to display correctly within Flowplayer.
First I send it to another PC via RTP. Here, I also checked with VLC that the codec etc. arrive correctly, which they do.
Now I want to expose this stream to Flowplayer as a file, so it can be displayed, via something I used in VLC:
http://localhost:8080/test.mp4
for example.
The full line I got is: ffmpeg -i input -f mp4 http://localhost:8080/test.mp4
However, no matter how I try to do this, I only get an input/output error. Is this only possible with something like ffserver or another?
What I think is this doesn't work because ffmpeg can't act as a server; on VLC it works since it can. (Though VLC ruins the codecs I set and it can't be read afterwards for some reason)
A (sort of) workaround I can use is saving the RTP stream to a file, and then letting flowplayer load it. This, however, only works once the file is not accessed anymore; I get a codec error otherwise.
To have FFmpeg act as an HTTP server, you need to pass the -listen 1 option. Additionally, -f mp4 will result in a non-fragmented MP4, which is not suitable for streaming. You can get a fragmented MP4 with -movflags frag_keyframe+empty_moov. A full working command line is:
ffmpeg -i input -listen 1 -f mp4 -movflags frag_keyframe+empty_moov http://localhost:8080
Other options you may find helpful are -re to limit the streaming speed to the input framerate, -stream_loop -1 to loop the input, and -c copy to avoid reencoding.
you need this command line
ffmpeg -f v4l2 -s 320x240 -r 25 -i /dev/video0 -f alsa -ac 1 -i hw:0 http://localhost:8090/feed1.ffm
make sure that your feed name ends with ".ffm" and if it's not the case, then add "-f ffm" before your feed URL, to manually specify the output format (because ffmpeg won't be able to figure it out automatically any more), like this "-f ffm http://localhost:8090/blah.bleh".