FFmpeg Converted files not working on firefox - html

When i convert a file with ffmpeg and play the video in firefox i get this error :
"VIDEOJS:" "ERROR:" "(CODE:3 MEDIA_ERR_DECODE)" "The video playback was aborted due to a corruption problem or because the video used features your browser did not support." Object { code: 3, message: "The video playback was aborted due to a corruption problem or because the video used features your browser did not support." }
In other browsers it's working perfect.
This is my ffmpeg convert command:
ffmpeg -i {input} -b 5500k -minrate 5500k -maxrate 5500k -bufsize 5500k -ab 384k -vcodec libx264 -acodec aac -strict -2 -ac 2 -ar 96000 -s 1280x720 -y {output}
Can someone tell me why the videos won't play in firefox?

Related

Gstreamer misses H.264

I wanted to try GStreamer to connect to a remote IP camera using RTSP stream.
So I've downloaded and installed the last version.
On Using GStreamer page said: GStreamer also provides playbin, a basic media-playback plugin that automatically takes care of most playback details
So I've tried to connect to the camera using the following command:
gst-launch-1.0 playbin uri=rtsp://192.168.1.2:554/av0_0
Unfortunately I get error:
ERROR: from element
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: Your GStreamer
installation is missing a plug-in. Additional debug info:
../gst/playback/gsturidecodebin.c(988): no_more_pads_full ():
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: no suitable
plugins found: ../gst/playback/gstdecodebin2.c(4679):
gst_decode_bin_expose ():
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0:
no suitable plugins found: Missing decoder: H.264 (Main Profile)
(video/x-h264, stream-format=(string)byte-stream,
alignment=(string)au, level=(string)3.1, profile=(string)main,
width=(int)1280, height=(int)720, framerate=(fraction)0/1,
interlace-mode=(string)progressive, chroma-format=(string)4:2:0,
bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8,
parsed=(boolean)true)
Does it mean that my installation missed decoder for h264? How could it been? I guess that h264 is the most popular codec. Did I do something wrong?
Update:
./gst-inspect-1.0 | grep h264
videoparsersbad: h264parse: H.264 parser
typefindfunctions: video/x-h264: h264, x264, 264
rtp: rtph264pay: RTP H264 payloader
rtp: rtph264depay: RTP H264 depayloader
openh264: openh264enc: OpenH264 video encoder
openh264: openh264dec: OpenH264 video decoder
Have you installed GStreamer MSI with the "Complete" option? If it's installed in Typical mode, then the libav plugins won't be installed. You can change the installation and select the additional feature or do a re-install.
When you install in the Complete mode, you should be able to find avdec_h264. Alternatively, you can select Custom mode and then enable the "GStreamer 1.0 libav wrapper".
$ gst-inspect-1.0.exe libav | grep h264
avdec_h264: libav H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 decoder

Realtime streaming video to HTML5 with RaspberryPi, gstreamer

I'm trying to make a live stream from a Raspberry camera available on a HTML5 webpage. Because of combination of factors, I would like to stream it to an outside server pc(Server pc os is window7) and this server should be able to supply the streams to the webpage HTML.
I'm able to get the stream from the Raspberry Pi and stream it with Gstreamer to an external server like this:
Raspberry Pi:
raspivid -n -t 0 -rot 270 -w 960 -h 720 -fps 30 -b 2000000 -o - | gst-launch-1.0 - e -vvvv fdsrc ! h264parse ! rtph24pay pt=96 config-interval=1 ! udpsink host=External IP port=5000
External server
gst-launch-1.0 -e -v udpsrc port=5000 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! fpsdisplaysink sync=false text-overlay=false
As a result I could display live video stream through gstreamer(GStreamer D3D video sink) in external server pc.
Now I have a problem:
I want to display this as HTML 5 video with Apache on server side (PC) instead of GStreamer D3D video output.
I searched for this solution for a long time but I couldn't find anything.

How to setup HLS and DVR functionality and read it?

I want to create an audio stream live with the DVR functionality.
In my player I want to listen live or seek the past stream (few minutes ago).
I use nginx to serve the hls stream.
How to setup the DVR functionality? Do I use a specific module in nginx for live stream and past stream with a param like past.m3u8?seek=timestamp
I'm also looking for a web player in html5 and fallback in flash to read the live stream and can seek the past.m3u8 stream.
I've setup nginx with this config:
location /hls {
# Serve HLS fragments
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
}
I create hls stream with avconv.
avconv -i [input] -vn -sn -c:a libfdk_aac -b:a 64k -hls_time 10 /path/to/hls/playlist.m3u8
To read this stream I use clipr player who permits to seek the stream.

convert from avi to mp4 using ffmpeg

I want to play an avi video format file in browsers using HTML5 video code. Since the
avi format file doesn't play in browsers i have to convert it into mp4 format file.
For conversion i am using the ffmpeg code in Windows.
ffmpeg -i input.avi OUTPUT.mp4
The conversion of video is completed but the video codec and audio codec isn't valid thus it fails to play to play using video tag in html5.
Please find me proper code which coverts the file.
another conversion code i tried was.. ffmpeg -i input.avi -c:v libx264 -preset slow -crf 22 -c:a libfaac -b:a 128k OUTPUTAVINew.mp4 but i got error as libfaac unknown encoder
please help me out and even i downloaded the **libfaac.dll** but didn't work out
`
Old, but this post comes up tops in searches so...
ffmpeg should easily convert from avi to mp4 without re-encoding. (Do not specify new codecs!)
ffmpeg -i input.avi -c:v copy -c:a copy OUTPUT.mp4
Should also mention that batch conversions run most reliably when the script contains static data with each ffmpeg call on a new line (as opposed to having the script generate each call dynamically using variables).
I would suggest you use the latest version of ffmpeg. You don't
need to download extra dlls.
Use libvo_aacenc instead of libfaac
-crf 22 is high use lower say -crf 19
As far my experience I would use
ffmpeg -i input.avi -c:v libx264 -preset slow -crf 19 -c:a libvo_aacenc -b:a 128k
code to avi to mp4.ffmpeg provides the best solution
ffmpeg -i input.avi -strict -2 output.mp4
For example there is a video file 139MB input.avi
ffprobe input.avi
Input #0, avi, from 'input.avi':
Metadata:
encoder : Lavf51.12.1
Duration: 00:21:20.16, start: 0.000000, bitrate: 891 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (xvid / 0x64697678), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 769 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 32000 Hz, stereo, fltp, 112 kb/s
For the nearly loseless re-containering use:
ffmpeg -i "input.avi" -c:v copy -c:a copy "input.mp4"
where -c:v copy copy video
-c:a copy copy audio
Conversion about 2 sec, result is input.mp4 138MB. It is fast, and almost same quality as original. Best practice is let the audio in the original format.
ffprobe input.mp4
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.29.100
Duration: 00:21:20.16, start: 0.000000, bitrate: 884 kb/s
Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 769 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 32000 Hz, stereo, fltp, 112 kb/s (default)
Metadata:
handler_name : SoundHandler
If you have time, and want to recodec almost same quality, but 1/3 size, use this:
ffmpeg -i "input.avi" -c:a copy -c:v vp9 -b:v 100K "input.vp9.mp4"
where -c:a copy copy audio -c:v vp9 -b:v 100K re-encode video with 100K bitrate. 138MB re-encoding takes about 40min and the new file size is 41MB the quality is nearly same as original, but pixeled a bit.
ffprobe input.vp9.mp4
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.29.100
Duration: 00:21:20.16, start: 0.000000, bitrate: 261 kb/s
Stream #0:0(und): Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv, progressive), 640x480, 146 kb/s, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 32000 Hz, stereo, fltp, 112 kb/s (default)
Metadata:
handler_name : SoundHandler

How can I watch my video from a sdp file?

I'm using ffmpeg to create a streaming. It works fine. I have a server and with ffplay I can watch my stream.
My only (big) constraint is real time.
I have to embed it into an HTML page accessible from mobile devices.
I tried with HTML5 video tag but I can't include sdp files into it.
With ffmpeg I create a stream from my webcam. I have also created the sdp file but in HTML5 doesn't work.
The code is here:
ffmpeg server:
sudo ffmpeg -re -f video4linux2 -i /dev/video0 -fflags no buffer rtp://224.10.20.30:20000
file.sdp
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 224.10.20.30
t=0 0
a=tool:libavformat 55.7.100
m=video 20000 RTP/AVP 96
b=AS:200
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=1
ffplay: (It works)
ffplay file.sdp
How can I view the stream in a browser?