Stroller <strol...@stellar.eclipse.co.uk> writes:

> On 9 Jul 2010, at 02:50, Allan Gottlieb wrote:
>
>> How should I view .m4v files with totem.
>> Is there a gst-plugin or a use flag for gst-plugins-meta?
>>
>> I have used the following, which "works", but the video quality is bad
>> ffmpeg -i file.m4v file.avi
>> totem file.avi
>
> Hi there,

First and foremost, thank you.
A lucid and informative explanation.

> I was been reluctant to reply earlier, because I'm not a real expert
> on the subject, but .m4v is a *container format*, as is .mp4  and
> .avi. .avi is actually a poorer one.
>
> http://en.wikipedia.org/wiki/.m4v
>
> I believe any of these containers can contain a variety of video /
> audio *codecs*. There are still loads of files floating around which
> use old Windows-centric codecs, but h264 is becoming the most common
> video codec. A container might contain the audio as MP3, AAC or
> something else.
>
> So it's not clear from just saying "convert from one file format to
> another" whether you converted the audio &/or video from one codec to
> another (known as "transcoding") or whether you just took the existing
> audio &/or video and simply put it in a different container (known as
> remuxing, I believe). A few minutes of video in an undemanding codec
> might be transcoded to shitty quality in a matter of minutes, nearly
> as quickly as remuxing a large video. The latter would depending on
> the speed of your disk / filesystem, but remuxing is a little slower
> than copying the whole multi-gigabyte file - that takes a couple of
> minutes around here. To transcode a full DVD to highest quality h264
> might take 18 or 24 hours (on a Pentium 4).
>
> As far as containers as concerned, .mp4 is a pretty good one. I
> _think_ that .m4v is very similar, but I can't swear to it. .avi is
> rubbish, but it's the default interim container for some converters -  
> I think that mplayer / mencoder, for instance can produce technically
> invalid .avi files that won't play on some systems, but it does that
> because it assumes you know what you're doing and will remux them  to
> .mp4 afterwards (using mp4box, for instance). .mkv is a container
> that is becoming very popular because it supports modern codes like
> h264/AAC but allows you to store multiple tracks within the container
> - Dolby stereo audio, 5.1 audio and a director's commentary, for
> instance, each of which may be in whatever codec you like. There is a
> shortcoming of of .mkv which applies to older systems with slower
> disks, but probably shouldn't apply here; if you can, use .mkv.
>
> I believe you should try using this command on the file:
>
>    mplayer -vo null -ao null -identify -endpos 1 myfile.m4v
>
> This should tell you more about the codecs in which the content are
> encoded. Feel free to post the output here.

Here it is.

ajglap gottlieb # mplayer -vo null -ao null -identify -endpos 1 
/a/video/Game_Theory_Lect_20_s.m4v
Creating config file: /root/.mplayer/config
MPlayer SVN-r30554-4.4.4 (C) 2000-2010 MPlayer Team

Playing /a/video/Game_Theory_Lect_20_s.m4v.
libavformat file format detected.
ID_VIDEO_ID=0
[lavf] stream 0: video (h264), -vid 0
ID_AUDIO_ID=0
ID_AID_0_LANG=eng
[lavf] stream 1: audio (aac), -aid 0, -alang eng
VIDEO:  [H264]  320x240  24bpp  29.970 fps  513.8 kbps (62.7 kbyte/s)
Clip info:
 major_brand: M4V 
ID_CLIP_INFO_NAME0=major_brand
ID_CLIP_INFO_VALUE0=M4V 
 minor_version: 1
ID_CLIP_INFO_NAME1=minor_version
ID_CLIP_INFO_VALUE1=1
 compatible_brands: M4V M4A mp42isom
ID_CLIP_INFO_NAME2=compatible_brands
ID_CLIP_INFO_VALUE2=M4V M4A mp42isom
ID_CLIP_INFO_N=3
ID_FILENAME=/a/video/Game_Theory_Lect_20_s.m4v
ID_DEMUXER=lavfpref
ID_VIDEO_FORMAT=H264
ID_VIDEO_BITRATE=513768
ID_VIDEO_WIDTH=320
ID_VIDEO_HEIGHT=240
ID_VIDEO_FPS=29.970
ID_VIDEO_ASPECT=0.0000
ID_AUDIO_FORMAT=MP4A
ID_AUDIO_BITRATE=118856
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
ID_START_TIME=0.00
ID_LENGTH=1994.25
ID_SEEKABLE=1
ID_CHAPTERS=0
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
AUDIO: 44100 Hz, 2 ch, s16le, 118.9 kbit/8.42% (ratio: 14857->176400)
ID_AUDIO_BITRATE=118856
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [null] 44100Hz 2ch s16le (2 bytes per sample)
ID_AUDIO_CODEC=faad
Starting playback...
Movie-Aspect is undefined - no prescaling applied.
VO: [null] 320x240 => 320x240 Planar YV12 
A:   1.0 V:   1.0 A-V:  0.001 ct:  0.022   0/  0  2%  0%  0.9% 0 0 

Exiting... (End of file)
ID_EXIT=EOF
ajglap gottlieb # 

> You didn't show us what the output (or verbose output) of your ffmpeg
> command was, so we don't know if the original .m4v had shitty quality,
> or if you transcoded it.

Here it is with verbose output

ajglap video # ffmpeg -loglevel verbose -i Game_Theory_Lect_20_s.m4v 
Game_Theory_Lect_20_s.avi
FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jun 21 2010 18:01:44 with gcc 4.4.4
  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
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0

Seems stream 0 codec frame rate differs from container frame rate: 5994.00 
(5994/1) -> 29.97 (2997/100)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Game_Theory_Lect_20_s.m4v':
  Metadata:
    major_brand     : M4V 
    minor_version   : 1
    compatible_brands: M4V M4A mp42isom
  Duration: 00:33:14.24, start: 0.000000, bitrate: 636 kb/s
    Stream #0.0(eng): Video: h264, yuv420p, 320x240, 513 kb/s, 29.97 fps, 29.97 
tbr, 2997 tbn, 5994 tbc
    Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 118 kb/s
Output #0, avi, to 'Game_Theory_Lect_20_s.avi':
  Metadata:
    ISFT            : Lavf52.64.2
    Stream #0.0(eng): Video: mpeg4, yuv420p, 320x240, q=2-31, 200 kb/s, 29.97 
tbn, 29.97 tbc
    Stream #0.1(eng): Audio: mp2, 44100 Hz, stereo, s16, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=59767 fps=470 q=3.6 Lsize=   67863kB time=1994.23 bitrate= 278.8kbits/s   
 
video:48981kB audio:15580kB global headers:0kB muxing overhead 5.113521%
ajglap video # 

> It's also worth checking the USE flags for all your video-playing
> applications - I enable at least the aac, h264 and mp3 USE flags on
> any new system, but I think Gentoo ships with them disabled by default
> because of licensing / patent / Freedom issues in some major
> jurisdictions.

I have the desktop profile so acc and mp3 are enabled by default.
I believe you mean the x264 USE flag, which is also enabled by default
in the desktop profile

ajglap gottlieb # grep h264 /usr/portage/profiles/use.desc 
x264 - Enable h264 encoding using x264
ajglap gottlieb # 

> HTH,

It does indeed.

I didn't have mplayer installed previously.  I just tried mplayer on
both the .m4v and .avi files.  Unlike totem it was able to play the m4v.
Like totem it played the .avi and like totem the quality was poor,
definitely worse than mplayer viewing the .m4v.  The .avi used in both
cases was the one produced by the mplayer command you gave above.

So

1.  mplayer can play the .m4v, which totem can't.

2.  I guess that means I need some option/plugin/use-flag for totem.
    Anyone have a hint?

3.  The conversion from .m4v to .avi costs quality.
    ffmpeg noted differing frame rates.  Is that relevant?
    Since the conversion of a 30 minute movie took
    only a very few minutes, your estimates above suggest that it was
    just remux-ed and not transcoded, at least not using a demanding
    codec.

thanks again,
allan

Reply via email to