Discussion:
[FFmpeg-user] AVC3 -> AVC1 conversion
antony baxter
2017-11-26 22:27:05 UTC
Permalink
Hello,

I've recently received some H264 videos marked as AVC3:

Duration: 00:29:00.00, start: 0.000000, bitrate: 949 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 125 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:1(und): Video: h264 (Main) (avc3 / 0x33637661), yuvj420p(pc,
bt709), 704x396 [SAR 1:1 DAR 16:9], 819 kb/s, 25 fps, 25 tbr, 25k tbn, 50
tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:2: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown),
192x108 [SAR 72:72 DAR 16:9], 90k tbr, 90k tbn, 90k tbc

These are not natively playable by quicktime/iTunes under OSX High Sierra
(10.13.1).

I can obviously convert them into H264 avc1 the long way, but wondered if
there was a quick way of simply changing the metadata of the avc3 stream
into avc1?

I've tried splitting the audio and video into two streams, and then
remuxing. This worked, but the video was "jerky" and unwatchable.

Thanks for your help.

Ant.
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-***@ffmpeg.org with subj
Moritz Barsnick
2017-11-27 22:14:30 UTC
Permalink
[...]
Stream #0:1(und): Video: h264 (Main) (avc3 / 0x33637661), yuvj420p(pc, bt709), 704x396 [SAR 1:1 DAR 16:9], 819 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
I can obviously convert them into H264 avc1 the long way, but wondered if
there was a quick way of simply changing the metadata of the avc3 stream
into avc1?
ffmpeg never just modifies the original, it at least demuxes and
remuxes. It doesn't need to reencode "the long way" though.

I'm sure there are tools out there to modify the FourCC by just
fiddling with a few bytes.

Anyway, you could try to remux using ffmpeg instead of re-encoding:

$ ffmpeg -i inputvideo -map 0 -c copy outputvideo.mp4

If that happens to retain the avc3 tag, add the option "-tag:v avc1".

Moritz
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-request@
Carl Eugen Hoyos
2017-11-27 22:26:54 UTC
Permalink
Post by antony baxter
I can obviously convert them into H264 avc1 the long way, but
wondered if there was a quick way of simply changing the
metadata of the avc3 stream into avc1?
Of course:
Use the hexeditor of your choice, search for "avc3" (it is either
on top or at the end of the file) and change it.

I am not sure if QT (or WMP) will play the resulting file though,
FFmpeg-based players will.

As Moritz explained: FFmpeg is not a file editor.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-***@ffmpeg.org with s
DopeLabs
2017-11-28 11:21:32 UTC
Permalink
the same thing happens by default when using ffmpeg to encode hevc/x265

ffmpeg creates an hevc format mp4 with a default fourcc of hev1, which osx will not play via quicktime, finder/quicklook. preview thumbnails/file icons also do not generate in finder.

changing the fourcc to hvc1 will make it work across osx in the above mentioned areas...

here is the command i used. you may apply the same methods with x264 with -tag:v avc1

$ ffmpeg -i x265.mp4 -c copy -tag:v hvc1 hvc1.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'x265.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf57.76.100
Duration: 00:41:50.01, start: 0.000000, bitrate: 348 kb/s
Stream #0:0(und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 1920x1080, 211 kb/s, 30 fps, 30 tbr, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Output #0, mp4, to 'hvc1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.2.100
Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, progressive), 1920x1080, q=2-31, 211 kb/s, 30 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=75300 fps=14676 q=-1.0 Lsize= 106784kB time=00:41:49.98 bitrate= 348.5kbits/s speed= 489x
video:64898kB audio:39220kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 2.560526%
Post by Carl Eugen Hoyos
Post by antony baxter
I can obviously convert them into H264 avc1 the long way, but
wondered if there was a quick way of simply changing the
metadata of the avc3 stream into avc1?
Use the hexeditor of your choice, search for "avc3" (it is either
on top or at the end of the file) and change it.
I am not sure if QT (or WMP) will play the resulting file though,
FFmpeg-based players will.
As Moritz explained: FFmpeg is not a file editor.
Carl Eugen
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-us
antony baxter
2017-11-28 21:50:04 UTC
Permalink
Thank you all your responses. However, I for me the "-tag:v avc1"
approach didn't work. Starting with input.mp4 which is shown as

Duration: 00:42:08.08, start: 0.000000, bitrate: 941 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 125 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:1(und): Video: h264 (Main) (avc3 / 0x33637661),
yuv420p(tv, bt709), 704x396 [SAR 1:1 DAR 16:9], 811 kb/s, 25 fps, 25
tbr, 25k tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:2: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown),
192x108 [SAR 72:72 DAR 16:9], 90k tbr, 90k tbn, 90k tbc

I ran:

% ffmpeg -i input.mp4 -c copy -tag:v avc1 output.mp4

and the resulting file output.mp4 was reported as:

Duration: 00:42:08.08, start: 0.000000, bitrate: 941 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661),
yuv420p(tv, bt709), 704x396 [SAR 1:1 DAR 16:9], 811 kb/s, 25 fps, 25
tbr, 25k tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 125 kb/s (default)
Metadata:
handler_name : SoundHandler

However Quicktime/iTunes/Preview all couldn't play this file (e.g.
preview opens a window with a spinning wheel in the middle and goes no
further).

What *has* worked for me is:

% ffmpeg -i input.mp4 -codec copy -bsf:v h264_mp4toannexb output.ts
% ffmpeg -i input.ts -codec copy output.mp4

I hope this is useful for someone else in the future.

Thanks

Ant.
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-***@ffmpeg.org with subject "unsubscr

Loading...