Convert AVI to MP4 - ffmpeg

I am running a debian 7.5 machine with ffmpeg-2.2 installed after these instructions

Problem

I am trying to display mp4 video inside my browser. The source file is in the AVI container format. I can successfully convert it to mp4, and the target file is readable (video + sound) using the totem player. So I thought everything would be OK, showing the next page

HTML5 webpage

<!DOCTYPE html><html>
<head>
    <title>Webcam</title>
</head>
<body>
<video width="640" height="480" controls>
  <source src="/path/to/output.mp4" type="video/mp4">
<h3>Your browser does not support the video tag</h3>
</video>
</body></html>

Input probe

$ ffprobe -show_streams input.avi

  Duration: 00:08:22.90, start: 0.000000, bitrate: 1943 kb/s
    Stream #0:0: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 64 kb/s
    Stream #0:1: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x540 [SAR 1:1 DAR 4:3], 1870 kb/s, 29.97 fps, 25 tbr, 29.97 tbn, 25 tbc

Convert

$ ffmpeg -y -fflags + genpts -i input.avi -acodec copy -vcodec copy ouput.mp4

HTML browser

Opening the above html file is played, but the video is not displayed.

When I use other .mp4 files, the video is displayed successfully, so I'm sure I ran into a conversion problem.

: ffmpeg, .

?

.

+4
2

( ) MPEG-4 Part 2 MP4, , , . H.264 MP4:

ffmpeg -i input.avi -c:v libx264 <... more options ...> -c:a libfaac \
-movflags +faststart output.mp4

-movflags +faststart , .

, :

<video width="640" height="480" controls>
  <source src="/path/to/output.mp4" type="video/mp4">
  <source src="/path/to/output.webm" type="video/webm">
  <source src="/path/to/output.ogv" type="video/ogg">
  ...
</video>

:

+6

WebM MP4. , , WebM .

<!DOCTYPE html><html>
<head>
    <title>Play a file</title>
</head>
<body>
<video width="640" height="480" controls>
  <source src="vid/output.webm" type="video/webm">
<h3>Your browser does not support the video tag</h3>
</video>

<video width="640" height="480" controls>
  <source src="vid/output.mp4" type="video/mp4">
<h3>Your browser does not support the video tag</h3>
</video>

</body></html>

, :

  • ffmpeg -i F:\Videos\bbb_1sec.ts./vid/output.mp4
  • ffmpeg -i F:\Videos\bbb_1sec.ts./vid/output.webm

MP4- Firefox 29... WebM

- VP8/vorbis. , () mp4, (: mpeg4 (Advanced Simple Profile) (XVID/0x44495658))

+2

Source: https://habr.com/ru/post/1541753/


All Articles