Gentoo Archives: gentoo-user

From: Allan Gottlieb <gottlieb@×××.edu>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] viewing .m4v files with totem
Date: Tue, 13 Jul 2010 20:20:43
Message-Id: yu9vd8j2kxp.fsf@nyu.edu
In Reply to: Re: [gentoo-user] viewing .m4v files with totem by Stroller
1 Stroller <stroller@××××××××××××××××××.uk> writes:
2
3 > On 9 Jul 2010, at 02:50, Allan Gottlieb wrote:
4 >
5 >> How should I view .m4v files with totem.
6 >> Is there a gst-plugin or a use flag for gst-plugins-meta?
7 >>
8 >> I have used the following, which "works", but the video quality is bad
9 >> ffmpeg -i file.m4v file.avi
10 >> totem file.avi
11 >
12 > Hi there,
13
14 First and foremost, thank you.
15 A lucid and informative explanation.
16
17 > I was been reluctant to reply earlier, because I'm not a real expert
18 > on the subject, but .m4v is a *container format*, as is .mp4 and
19 > .avi. .avi is actually a poorer one.
20 >
21 > http://en.wikipedia.org/wiki/.m4v
22 >
23 > I believe any of these containers can contain a variety of video /
24 > audio *codecs*. There are still loads of files floating around which
25 > use old Windows-centric codecs, but h264 is becoming the most common
26 > video codec. A container might contain the audio as MP3, AAC or
27 > something else.
28 >
29 > So it's not clear from just saying "convert from one file format to
30 > another" whether you converted the audio &/or video from one codec to
31 > another (known as "transcoding") or whether you just took the existing
32 > audio &/or video and simply put it in a different container (known as
33 > remuxing, I believe). A few minutes of video in an undemanding codec
34 > might be transcoded to shitty quality in a matter of minutes, nearly
35 > as quickly as remuxing a large video. The latter would depending on
36 > the speed of your disk / filesystem, but remuxing is a little slower
37 > than copying the whole multi-gigabyte file - that takes a couple of
38 > minutes around here. To transcode a full DVD to highest quality h264
39 > might take 18 or 24 hours (on a Pentium 4).
40 >
41 > As far as containers as concerned, .mp4 is a pretty good one. I
42 > _think_ that .m4v is very similar, but I can't swear to it. .avi is
43 > rubbish, but it's the default interim container for some converters -
44 > I think that mplayer / mencoder, for instance can produce technically
45 > invalid .avi files that won't play on some systems, but it does that
46 > because it assumes you know what you're doing and will remux them to
47 > .mp4 afterwards (using mp4box, for instance). .mkv is a container
48 > that is becoming very popular because it supports modern codes like
49 > h264/AAC but allows you to store multiple tracks within the container
50 > - Dolby stereo audio, 5.1 audio and a director's commentary, for
51 > instance, each of which may be in whatever codec you like. There is a
52 > shortcoming of of .mkv which applies to older systems with slower
53 > disks, but probably shouldn't apply here; if you can, use .mkv.
54 >
55 > I believe you should try using this command on the file:
56 >
57 > mplayer -vo null -ao null -identify -endpos 1 myfile.m4v
58 >
59 > This should tell you more about the codecs in which the content are
60 > encoded. Feel free to post the output here.
61
62 Here it is.
63
64 ajglap gottlieb # mplayer -vo null -ao null -identify -endpos 1 /a/video/Game_Theory_Lect_20_s.m4v
65 Creating config file: /root/.mplayer/config
66 MPlayer SVN-r30554-4.4.4 (C) 2000-2010 MPlayer Team
67
68 Playing /a/video/Game_Theory_Lect_20_s.m4v.
69 libavformat file format detected.
70 ID_VIDEO_ID=0
71 [lavf] stream 0: video (h264), -vid 0
72 ID_AUDIO_ID=0
73 ID_AID_0_LANG=eng
74 [lavf] stream 1: audio (aac), -aid 0, -alang eng
75 VIDEO: [H264] 320x240 24bpp 29.970 fps 513.8 kbps (62.7 kbyte/s)
76 Clip info:
77 major_brand: M4V
78 ID_CLIP_INFO_NAME0=major_brand
79 ID_CLIP_INFO_VALUE0=M4V
80 minor_version: 1
81 ID_CLIP_INFO_NAME1=minor_version
82 ID_CLIP_INFO_VALUE1=1
83 compatible_brands: M4V M4A mp42isom
84 ID_CLIP_INFO_NAME2=compatible_brands
85 ID_CLIP_INFO_VALUE2=M4V M4A mp42isom
86 ID_CLIP_INFO_N=3
87 ID_FILENAME=/a/video/Game_Theory_Lect_20_s.m4v
88 ID_DEMUXER=lavfpref
89 ID_VIDEO_FORMAT=H264
90 ID_VIDEO_BITRATE=513768
91 ID_VIDEO_WIDTH=320
92 ID_VIDEO_HEIGHT=240
93 ID_VIDEO_FPS=29.970
94 ID_VIDEO_ASPECT=0.0000
95 ID_AUDIO_FORMAT=MP4A
96 ID_AUDIO_BITRATE=118856
97 ID_AUDIO_RATE=44100
98 ID_AUDIO_NCH=2
99 ID_START_TIME=0.00
100 ID_LENGTH=1994.25
101 ID_SEEKABLE=1
102 ID_CHAPTERS=0
103 ==========================================================================
104 Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
105 Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
106 ==========================================================================
107 ID_VIDEO_CODEC=ffh264
108 ==========================================================================
109 Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
110 AUDIO: 44100 Hz, 2 ch, s16le, 118.9 kbit/8.42% (ratio: 14857->176400)
111 ID_AUDIO_BITRATE=118856
112 ID_AUDIO_RATE=44100
113 ID_AUDIO_NCH=2
114 Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
115 ==========================================================================
116 AO: [null] 44100Hz 2ch s16le (2 bytes per sample)
117 ID_AUDIO_CODEC=faad
118 Starting playback...
119 Movie-Aspect is undefined - no prescaling applied.
120 VO: [null] 320x240 => 320x240 Planar YV12
121 A: 1.0 V: 1.0 A-V: 0.001 ct: 0.022 0/ 0 2% 0% 0.9% 0 0
122
123 Exiting... (End of file)
124 ID_EXIT=EOF
125 ajglap gottlieb #
126
127 > You didn't show us what the output (or verbose output) of your ffmpeg
128 > command was, so we don't know if the original .m4v had shitty quality,
129 > or if you transcoded it.
130
131 Here it is with verbose output
132
133 ajglap video # ffmpeg -loglevel verbose -i Game_Theory_Lect_20_s.m4v Game_Theory_Lect_20_s.avi
134 FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers
135 built on Jun 21 2010 18:01:44 with gcc 4.4.4
136 configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-static --enable-shared --cc=x86_64-pc-linux-gnu-gcc --disable-debug --disable-network --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --disable-indev=v4l --disable-indev=v4l2 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --enable-x11grab --disable-vdpau --disable-vdpau --disable-vaapi --disable-altivec --cpu=host --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-avfilter-lavf --disable-stripping --enable-hardcoded-tables --disable-doc
137 libavutil 50.15. 1 / 50.15. 1
138 libavcodec 52.72. 2 / 52.72. 2
139 libavformat 52.64. 2 / 52.64. 2
140 libavdevice 52. 2. 0 / 52. 2. 0
141 libavfilter 1.19. 0 / 1.19. 0
142 libswscale 0.11. 0 / 0.11. 0
143 libpostproc 51. 2. 0 / 51. 2. 0
144
145 Seems stream 0 codec frame rate differs from container frame rate: 5994.00 (5994/1) -> 29.97 (2997/100)
146 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Game_Theory_Lect_20_s.m4v':
147 Metadata:
148 major_brand : M4V
149 minor_version : 1
150 compatible_brands: M4V M4A mp42isom
151 Duration: 00:33:14.24, start: 0.000000, bitrate: 636 kb/s
152 Stream #0.0(eng): Video: h264, yuv420p, 320x240, 513 kb/s, 29.97 fps, 29.97 tbr, 2997 tbn, 5994 tbc
153 Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 118 kb/s
154 Output #0, avi, to 'Game_Theory_Lect_20_s.avi':
155 Metadata:
156 ISFT : Lavf52.64.2
157 Stream #0.0(eng): Video: mpeg4, yuv420p, 320x240, q=2-31, 200 kb/s, 29.97 tbn, 29.97 tbc
158 Stream #0.1(eng): Audio: mp2, 44100 Hz, stereo, s16, 64 kb/s
159 Stream mapping:
160 Stream #0.0 -> #0.0
161 Stream #0.1 -> #0.1
162 Press [q] to stop encoding
163 frame=59767 fps=470 q=3.6 Lsize= 67863kB time=1994.23 bitrate= 278.8kbits/s
164 video:48981kB audio:15580kB global headers:0kB muxing overhead 5.113521%
165 ajglap video #
166
167 > It's also worth checking the USE flags for all your video-playing
168 > applications - I enable at least the aac, h264 and mp3 USE flags on
169 > any new system, but I think Gentoo ships with them disabled by default
170 > because of licensing / patent / Freedom issues in some major
171 > jurisdictions.
172
173 I have the desktop profile so acc and mp3 are enabled by default.
174 I believe you mean the x264 USE flag, which is also enabled by default
175 in the desktop profile
176
177 ajglap gottlieb # grep h264 /usr/portage/profiles/use.desc
178 x264 - Enable h264 encoding using x264
179 ajglap gottlieb #
180
181 > HTH,
182
183 It does indeed.
184
185 I didn't have mplayer installed previously. I just tried mplayer on
186 both the .m4v and .avi files. Unlike totem it was able to play the m4v.
187 Like totem it played the .avi and like totem the quality was poor,
188 definitely worse than mplayer viewing the .m4v. The .avi used in both
189 cases was the one produced by the mplayer command you gave above.
190
191 So
192
193 1. mplayer can play the .m4v, which totem can't.
194
195 2. I guess that means I need some option/plugin/use-flag for totem.
196 Anyone have a hint?
197
198 3. The conversion from .m4v to .avi costs quality.
199 ffmpeg noted differing frame rates. Is that relevant?
200 Since the conversion of a 30 minute movie took
201 only a very few minutes, your estimates above suggest that it was
202 just remux-ed and not transcoded, at least not using a demanding
203 codec.
204
205 thanks again,
206 allan

Replies

Subject Author
Re: [gentoo-user] viewing .m4v files with totem Stroller <stroller@××××××××××××××××××.uk>