mp4

Which pixel format for web mp4 video?

人盡茶涼 提交于 2019-12-01 16:35:52
问题 I have to create video in mp4 format, and it seems that I can encode it with different pixel formats like yuv420p , yuv422p , yuvj422p . Which one I should use to maximize compatibility with most browsers/players? 回答1: Use yuv420p You can use the -vf format=yuv420p (or the alias -pix_fmt yuv420p ) output option to make sure your output is YUV 4:2:0. Example ffmpeg -i input -c:v libx264 -crf 23 -preset medium -vf format=yuv420p -c:a copy -movflags +faststart output.mp4 For web video the

Getting MP4 File Duration with DirectShow

自作多情 提交于 2019-12-01 14:15:07
I need to get the duration of an mp4 file, preferably as a double in seconds. I was using DirectShow (see code below), but it keeps throwing a particularly unhelpful error. I'm wondering if someone has an easy solution to this. (Seriously, who knew that getting that information would be so difficult) public static void getDuration(string moviePath) { FilgraphManager m_objFilterGraph = null; m_objFilterGraph = new FilgraphManager(); m_objFilterGraph.RenderFile(moviePath); IMediaPosition m_objMediaPosition = null; m_objMediaPosition = m_objFilterGraph as IMediaPosition; Console.WriteLine(m

mp4 file through php not playing as html5 video

泪湿孤枕 提交于 2019-12-01 13:59:08
I am trying to output an mp4 video file through PHP. When it is used through a flash player (eg. flowplayer) it is working great. But when I'm trying to use it as a source on an html5 video tag or to call directly the php file, it doesn't work. The code I use is the following: $filesize = filesize($file); header("Content-Type: video/mp4"); if ( empty($_SERVER['HTTP_RANGE']) ) { header("Content-Length: $filesize"); readfile($file); } else //violes rfc2616, which requires ignoring the header if it's invalid { rangeDownload($file); } and rangeDownload function is from http://mobiforge.com

mp4 file through php not playing as html5 video

混江龙づ霸主 提交于 2019-12-01 13:52:32
问题 I am trying to output an mp4 video file through PHP. When it is used through a flash player (eg. flowplayer) it is working great. But when I'm trying to use it as a source on an html5 video tag or to call directly the php file, it doesn't work. The code I use is the following: $filesize = filesize($file); header("Content-Type: video/mp4"); if ( empty($_SERVER['HTTP_RANGE']) ) { header("Content-Length: $filesize"); readfile($file); } else //violes rfc2616, which requires ignoring the header if

Getting MP4 File Duration with DirectShow

左心房为你撑大大i 提交于 2019-12-01 12:34:56
问题 I need to get the duration of an mp4 file, preferably as a double in seconds. I was using DirectShow (see code below), but it keeps throwing a particularly unhelpful error. I'm wondering if someone has an easy solution to this. (Seriously, who knew that getting that information would be so difficult) public static void getDuration(string moviePath) { FilgraphManager m_objFilterGraph = null; m_objFilterGraph = new FilgraphManager(); m_objFilterGraph.RenderFile(moviePath); IMediaPosition m

How to have ffmpeg calculate the width after modifying by set height ratio?

孤街浪徒 提交于 2019-12-01 11:57:41
After finding the resolution was the source of all my webm to MP4 codec conversion errors on my Android. I came across another problem. To break down my question: What all MP4 resolutions are supported on most devices? I know they go by p from certain height value for them to work. 720p /?X720 for example. Is there an easier way to calculate the width based from the height change while keeping the ratio? ffmpeg -i old.webm -t 00:00:03 -s 320x240 new.mp4 I currently use the -s setting perimeter from my testing example. The standard ratio for widescreens is 16:9 and the typical list of

Split MPEG-TS into MP4 files with gstreamer 1.12.2

ぃ、小莉子 提交于 2019-12-01 11:53:50
问题 I have a MPEG-TS file which contains two video/audio stream-pairs: $ gst-discoverer-1.0 Recorder_Aug01_12-30-39.ts Analyzing Recorder_Aug01_12-30-39.ts Done discovering Recorder_Aug01_12-30-39.ts Topology: container: MPEG-2 Transport Stream audio: MPEG-2 AAC audio: MPEG-4 AAC video: H.264 (High Profile) audio: MPEG-2 AAC audio: MPEG-4 AAC video: H.264 (High Profile) Properties: Duration: 0:01:49.662738259 Seekable: yes Tags: audio codec: MPEG-2 AAC video codec: H.264 Now I would like to

Convert MP4 Version - FFmpeg

故事扮演 提交于 2019-12-01 11:38:20
I have two mp4 File : out.mp4: ISO Media, MP4 Base Media v1 [IS0 14496-12:2003] video/rio2016/finale/brasse/200.mp4: ISO Media, MP4 v2 [ISO 14496-14] How can I convert 1 to 2 (mp41 to mp42) ? Thanks ! Using ffmpeg, it's ffmpeg -i out.mp4 -c copy -map 0 -brand mp42 out2.mp4 来源: https://stackoverflow.com/questions/43606730/convert-mp4-version-ffmpeg

Media Foundation IMFSinkWriter::Finalize() method fails under Windows 7 when muxing H.264 frames into MP4

梦想的初衷 提交于 2019-12-01 11:24:39
I'm writing a tool in C# that muxes H.264 frames into MP4 files, and I'm using Media Foundation's media sink with sink writer to do this. Things work pretty well under Win8, but under Windows 7 the same code throws an exception, HResult: 0xC00D36E6 (MF_E_ATTRIBUTENOTFOUND), when invoking sink writer's Finalize method. As a result, the generated MP4 file is not properly closed, and is (of course) not playable. The mftrace log shows that the failure under Windows 7 occurs somewhere after (or during) the internal call to IMFSinkWriter::PlaceMarker. Under Windows 8 the corresponding line in the

getting PVMFErrContentInvalidForProgressivePlayback error while playing mp4 files on samsung devices

本小妞迷上赌 提交于 2019-12-01 11:07:46
I'm using classic VideoView implementation to play video on Android. Same mp4 file url works fine on HTC Desire. However it doesn't work on Samsung devices. Samsung Galaxy S1 and Samsung Galaxy Tab say: "Cannot play video. Unable to play video. Invalid streaming data" Samsung 5110 says: "Cannot play video. Sorry this video is not valid for streaming to this device" When I looked at mp4 file with a text editor, I realized that mdat tag is before moov . My question is how does it work on HTC whereas it doesn't on samsung devices. And I dont have any chances to change the format of mp4 files, so