On Sat, 19 Jul 2014, David Favor wrote:
Do mention if these options resolve your problem. I'd be interesting in
hearing.
Oh I do found ways to achieve what I wished.
Let me clearify the use case first. I am trying to copy videos into iOS.
It seems iOS pickes on DAR - every other file with DAR equal to 4:3 can be
copied into iOS except this one. Input file:
$ ffmpeg -i 09-15.avi
ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 29 2013 21:37:41 with gcc 4.6 (Debian 4.6.3-14)
Input #0, avi, from '09-15.avi':
Metadata:
encoder : VirtualDubMod 1.5.10.2 (build 2540/release)
Duration: 01:43:57.00, start: 0.000000, bitrate: 1855 kb/s
Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 640x496 [SAR 1:1
DAR 40:31], 25 fps, 25 tbr, 25 tbn, 30k tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 133
kb/s
I supose if I can make DAR be 4:3, not 40:31, and do it without re-encoding,
iOS will take it.
I indeed achieved it, but iOS still won't take it at DAR 4:3. These are my
attempts.
1. ---------------------------- Setting ffmpeg with -aspect
$ ffmpeg -aspect 4:3 -i 09-15.avi output.mp4 ffmpeg version 1.2.4 Copyright
(c) 2000-2013 the FFmpeg developers
built on Nov 29 2013 21:37:41 with gcc 4.6 (Debian 4.6.3-14)
Input #0, avi, from '09-15.avi':
Metadata:
encoder : VirtualDubMod 1.5.10.2 (build 2540/release)
Duration: 01:43:57.00, start: 0.000000, bitrate: 1855 kb/s
Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 640x496 [SAR 1:1
DAR 40:31], 25 fps, 25 tbr, 25 tbn, 30k tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 133
kb/s
Illegal instruction
I thought Illegal instruction may be caused by encoding AAC, hence:
$ ffmpeg -aspect 4:3 -i 09-15.avi -c:a copy output.mp4
But I got the same Illegal instruction
2. ---------------------------- Using mp4track
$ mp4track --track-id=3 --pasp-add --pasp-parms=4,3 09-15.mp4
The result has this weired output:
Stream #0:2(und): Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 640x496 [SAR 1:1
DAR 40:31], 1708 kb/s, SAR 4:3 DAR 160:93, 25 fps, 25 tbr, 12800 tbn, 30k tbc
What is weird: SAR/DAR appeared twice. I guess (tell me if I guessed wrong):
[SAR 1:1 DAR 40:31] means the SAR/DAR in the container
SAR 4:3 DAR 160:93 means the SAR/DAR in the video stream
3. ---------------------------- Use avconv
$ avconv -i 09-15.avi -c:a copy -aspect 4:3 output.mp4
avconv version 9.13-6:9.13-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav
developers
built on May 9 2014 13:34:03 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
Input #0, avi, from '09-15.avi':
Metadata:
encoder : VirtualDubMod 1.5.10.2 (build 2540/release)
Duration: 01:43:57.00, start: 0.000000, bitrate: 1855 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 640x496 [PAR 1:1 DAR 40:31], 25 fps, 25
tbr, 25 tbn, 30k tbc
Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16p, 133 kb/s
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf54.20.4
Stream #0.0: Video: libx264, yuv420p, 640x496 [PAR 31:30 DAR 4:3], q=-1--1,
25 tbn, 25 tbc
Stream #0.1: Audio: libmp3lame, 48000 Hz, stereo, 133 kb/s
I know the produced PAR 31:30 is a weird number, but finally this video can
be played back on ipad, which seems to insist on DAR being a small number.
The big down-side is that I have to re-encode the video. Maybe this is the
best I can do, so this one isn't exactly a failure.
4. ---------------------------- Use MP4Box, setting SAR
$ MP4Box -tmp . -add 09-15.mp4#video:par=31:30 -add 09-15.mp4#audio
output2.mp4
IsoMedia import - track ID 3 - Video (size 640 x 496)
IsoMedia import - track ID 1 - Audio (SR 48000 - 1 channels)
Saving to output2.mp4: 0.500 secs Interleaving
$ avconv -i 09-15.mp4.mp4
avconv version 9.13-6:9.13-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav
developers
built on May 9 2014 13:34:03 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '09-15.mp4.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2014-07-20 14:05:23
Duration: 01:43:57.03, start: 0.000000, bitrate: 1839 kb/s
Stream #0.0(und): Video: mpeg4, yuv420p, 640x496 [PAR 31:30 DAR 4:3], 1708
kb/s, 25 fps, 25 tbr, 12800 tbn, 30k tbc
Metadata:
creation_time : 2014-07-20 14:05:23
Stream #0.1(und): Audio: aac, 48000 Hz, mono, fltp, 127 kb/s
Metadata:
creation_time : 2014-07-20 14:06:23
(if I adjust sar instead of par, there will be no noticable change):
So the effect I wish to achieve, has been achieved: DAR is 4:3 without
re-encoding. But to my surprise, iTunes refused to copy this video to iPAD
with a simple message that it cannot do so. Surprise, because the same
PAR/DAR video was copied into iPAD (see previous attempt with avconv).
So the conclusion is:
- It's possible to adjust PAR/DAR without reencoding, using mp4box.
- iPAD will not accept mpeg4-encoded video if not using common pixel-size,
PAR and DAR, but they will accept h264 video with the same set of
parameters.
_______________________________________________
libav-tools mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-tools