Log in

View Full Version : Sony PXW-FS7 XAVC Format Rewrapping with ffMPEG?


BassPig
29th July 2015, 00:09
Does anyone know the command string for ffMPEG that rewraps XAVC-I footage to MP4 WITHOUT compressing the audio (leaving it PCM)?

I have gotten as far as rewrapping, but with compression of the audio to AAC with the following:

K:\FS7 Footage\XDROOT\Clip>K:\ffmpeg-20150720-git-9ebe041-win64-static\bin\ffmpe
g -loglevel error -y -i "302_0003.MXF" -map 0:0 -filter_complex "[0:1] [0:2] ame
rge" -acodec aac -b:a 256k -strict -2 -vcodec copy -metadata "date=2014-11-17 00
:24:47" "302_0003.mp4"

What should I change in the above command to leave audio PCM but still rewrap?

poisondeathray
29th July 2015, 00:19
PCM audio in MP4 is not supported by ffmpeg's muxer. You can use MOV instead

I think the most recent l-smash muxer can mux PCM into MP4

BassPig
29th July 2015, 01:32
I'm not familiar with the syntax of ffMPEG commands, so what would I change to rewrap to MOV (assuming it supports h.264 high level for the video portion)?

My futile attempts at trying various alterations resulted in many "invalid argument" and "error initializing complex filters" responses.

raffriff42
29th July 2015, 01:54
Does anyone know the command string for ffMPEG that rewraps XAVC-I footage to MP4 WITHOUT compressing the audio (leaving it PCM)?ffmpeg -loglevel error -y -i "302_0003.MXF" -map 0:0 -filter_complex "[0:1] [0:2] amerge" -acodec pcm_s16le -vcodec copy -metadata "date=2014-11-17 00:24:47" "302_0003.mov"

Since you seem to be merging two audio channels (are you sure you want to do that?), you can't use "-acodec copy". To do that, delete the green text.

BassPig
29th July 2015, 01:54
Trying to keep it simple:

>ffmpeg 302_0003.mxf -acodec copy -vcodec copy 302_0003.mov

but that doesn't work:


Output file #0 does not contain any stream

poisondeathray
29th July 2015, 02:04
what is the stream mapping ?

ffmpeg -i 302_0003.mxf

=> what does that say about the track numbering ?

raffriff42
29th July 2015, 02:23
Seconding poisondeathray's request.

I think "-map 0:0" is required, but not sure why. Also, according to this (http://ffmpeg.org/pipermail/ffmpeg-user/2014-November/024413.html), try adding "-vtag aivx" before the final output file name.

BassPig
29th July 2015, 03:16
I obtained these strings off the internet while searching for ways to convert Sony FS7 footage to a format readable in Premiere. It was told to me that the channel mapping was to combine two mono channels into one stereo track. That works, but the audio is no longer original--it has been recoded to AAC.

In the interim, I downloaded Avanti, a GUI for ffMPEG.
This has made some things easier, but also seems to lack some mapping abilities. I am not getting the same audio results as with the command line.

I set destination audio settings to 'copy audio' and destination video to 'copy video' in the mp4 container. However, this results in an error. It will only succeed if I choose AAC for the CODEC. But then, despite channels set to 'source', I end up with 1 mono audio track instead of the 8 that the camera includes in its file.

I found one container, AVI that will accept copy audio and copy video. But alas, Premiere CS6 will accept the file, complaining that the file is missing CODEC or damaged.

The command line process takes about 20 seconds for a 14 second clip and results in stereo audio track, albeit compressed AAC. The GUI version takes 2 seconds, but results in a single mono AAC track. Somehow, Avanti isn't respecting the track mappings from the original XAVC file.

BassPig
29th July 2015, 03:18
ffmpeg -loglevel error -y -i "302_0003.MXF" -map 0:0 -filter_complex "[0:1] [0:2] amerge" -acodec pcm_s16le -vcodec copy -metadata "date=2014-11-17 00:24:47" "302_0003.mov"

Since you seem to be merging two audio channels (are you sure you want to do that?), you can't use "-acodec copy". To do that, delete the green text.

Result no good:

No suitable decoder module:
VLC does not support the audio or video format "aivx". Unfortunately there is no way for you to fix this.
No suitable decoder module:
VLC does not support the audio or video format "aivx". Unfortunately there is no way for you to fix this.

poisondeathray
29th July 2015, 03:36
The problem is there are slightly different XAVC-I configurations

Here is a example that works for the configuration in the video I have

You need to use -map for each stream


ffmpeg -i INPUT.MXF -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -map 0:6 -map 0:7 -map 0:8 -c:v copy -c:a copy OUTPUT.mov


mediainfo input file

Format : MXF
Format version : 1.3
Format profile : OP-1a
Format settings : Closed / Complete
File size : 58.4 MiB
Duration : 4s 838ms
Overall bit rate : 101 Mbps
Encoded date : 2015-03-23 17:43:15.000
Writing application : Sony Mem 2.00

Video
ID : 2
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High 4:2:2 Intra@L4.1
Format settings, CABAC : No
Format settings, GOP : N=1
Format settings, wrapping mode : Frame
Codec ID : 0D01030102106001-0401020201323103
Duration : 4s 838ms
Bit rate : 92.1 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Standard : Component
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 10 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 1.853
Stream size : 53.1 MiB (91%)
Color range : Full
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

Audio #1
ID : 3
Format : PCM
Format settings, Endianness : Little
Format settings, wrapping mode : Frame (AES)
Codec ID : 0D01030102060300-0402020101000000
Duration : 4s 838ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)

Audio #2
ID : 4
Format : PCM
Format settings, Endianness : Little
Format settings, wrapping mode : Frame (AES)
Codec ID : 0D01030102060300-0402020101000000
Duration : 4s 838ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)

Audio #3
ID : 5
Format : PCM
Format settings, Endianness : Little
Format settings, wrapping mode : Frame (AES)
Codec ID : 0D01030102060300-0402020101000000
Duration : 4s 838ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)

Audio #4
ID : 6
Format : PCM
Format settings, Endianness : Little
Format settings, wrapping mode : Frame (AES)
Codec ID : 0D01030102060300-0402020101000000
Duration : 4s 838ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)

Audio #5
ID : 7
Format : PCM
Format settings, Endianness : Little
Format settings, wrapping mode : Frame (AES)
Codec ID : 0D01030102060300-0402020101000000
Duration : 4s 838ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)

Audio #6
ID : 8
Format : PCM
Format settings, Endianness : Little
Format settings, wrapping mode : Frame (AES)
Codec ID : 0D01030102060300-0402020101000000
Duration : 4s 838ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)

Audio #7
ID : 9
Format : PCM
Format settings, Endianness : Little
Format settings, wrapping mode : Frame (AES)
Codec ID : 0D01030102060300-0402020101000000
Duration : 4s 838ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)

Audio #8
ID : 10
Format : PCM
Format settings, Endianness : Little
Format settings, wrapping mode : Frame (AES)
Codec ID : 0D01030102060300-0402020101000000
Duration : 4s 838ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)

Other #1
ID : 1-Material
Type : Time code
Format : MXF TC
Time code of first frame : 00:52:37:04
Time code settings : Material Package
Time code, striped : Yes

Other #2
ID : 1-Source
Type : Time code
Format : MXF TC
Time code of first frame : 00:52:37:04
Time code settings : Source Package
Time code, striped : Yes

Other #3
ID : 11
Format : Acquisition Metadata
Muxing mode : Ancillary data / RDD 18
Duration : 4s 838ms
Frame rate : 23.976 fps
ExposureIndexofPhotoMeter : 800
NeutralDensityFilterWheelSetting : 16
CaptureFrameRate : 23.976
ImageSensorReadoutMode : Progressive frame
ShutterSpeed_Angle : 180.0
ISOSensitivity : 800
WhiteBalance : 5341
CaptureGammaEquation : 0E06040101010203
GammaforCDL : Undefined

Other #4
Type : Time code
Format : SMPTE TC
Muxing mode : SDTI
Time code of first frame : 00:52:37:04

poisondeathray
29th July 2015, 03:37
mediainfo output file

And it plays fine in Adobe, MPCHC, VLC etc...

Or consider upgrading Adobe. CC has support for all XAVC variants (native import)

If you need more specific help, you need to post the console output of ffmpeg's track numbers (or if using a GUI, look for a log file)




(sorry last post was over limit)


Format : MPEG-4
Format profile : QuickTime
Codec ID : qt
File size : 57.6 MiB
Duration : 4s 839ms
Overall bit rate : 99.9 Mbps
Writing application : Lavf56.40.100

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High 4:2:2 Intra@L4.1
Format settings, CABAC : No
Format settings, GOP : N=1
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 4s 839ms
Bit rate mode : Constant
Bit rate : 90.6 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 fps
Standard : Component
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 10 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 1.823
Stream size : 52.3 MiB (91%)
Language : English
Color range : Full
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

Audio #1
ID : 2
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Unsigned
Codec ID : in24
Duration : 4s 839ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)
Language : English

Audio #2
ID : 3
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Unsigned
Codec ID : in24
Duration : 4s 839ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)
Language : English

Audio #3
ID : 4
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Unsigned
Codec ID : in24
Duration : 4s 839ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)
Language : English

Audio #4
ID : 5
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Unsigned
Codec ID : in24
Duration : 4s 839ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)
Language : English

Audio #5
ID : 6
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Unsigned
Codec ID : in24
Duration : 4s 839ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)
Language : English

Audio #6
ID : 7
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Unsigned
Codec ID : in24
Duration : 4s 839ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)
Language : English

Audio #7
ID : 8
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Unsigned
Codec ID : in24
Duration : 4s 839ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)
Language : English

Audio #8
ID : 9
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Unsigned
Codec ID : in24
Duration : 4s 839ms
Bit rate mode : Constant
Bit rate : 1 152 Kbps
Channel(s) : 1 channel
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Stream size : 680 KiB (1%)
Language : English

Other
ID : 10
Type : Time code
Format : QuickTime TC
Duration : 4s 839ms
Time code of first frame : 00:52:37:04
Time code, striped : Yes
Language : English

BassPig
29th July 2015, 09:40
Rewrapping with that command produces a file that gets this error in VLC:

"No suitable decoder module:
VLC does not support the audio or video format "aivx". Unfortunately there is no way for you to fix this."

An attempt to import this file into Premiere hangs Premiere.

CS6 is the last version of Adobe I can buy. If need be, I'll retool and retrain to use DaVinci Resolve.

XAVC is just h.264 and h.264 plays fine in CS6. Also CS6 is the most stable version of Premiere that I've used. There must be a way to rewrap without losing audio quality, yet maintain compatibility with CS6.

raffriff42
29th July 2015, 10:48
Please read and respond to Post #6 (http://forum.doom9.org/showthread.php?p=1732000#post1732000)

A MediaInfo report like in post #10-11 might help as well.

If possible, please upload a short (<10MB) sample somewhere we can access it

EDIT you might use
ffmpeg -i "302_0003.MXF" -c copy -t 0:00:05 "302_0003_5sec.MXF"
...to make a short clip. Doing this might affect track layout etc, but the streams themselves should copy over.

poisondeathray
29th July 2015, 14:13
When I add the vtag, I get the same error message. Don't add the tag and it works fine in VLC

I don't have CS6 installed currently, except Encore. If you put the video into a transport stream it works in Encore CS6, so I'm assuming it will work in PP CS6 . The MOV crashes Encore CS6, but not PP CC. So try a transport stream instead

Or something might be different about your video, then post a sample

BassPig
30th July 2015, 03:16
Please read and respond to Post #6 (http://forum.doom9.org/showthread.php?p=1732000#post1732000)

A MediaInfo report like in post #10-11 might help as well.

If possible, please upload a short (<10MB) sample somewhere we can access it

EDIT you might use
ffmpeg -i "302_0003.MXF" -c copy -t 0:00:05 "302_0003_5sec.MXF"
...to make a short clip. Doing this might affect track layout etc, but the streams themselves should copy over.

Here's the result of the command:

"[mxf @ 0000000000362fa0] decoding for stream 0 failed
Guessed Channel Layout for Input Stream #0.1 : mono
Guessed Channel Layout for Input Stream #0.2 : mono
Guessed Channel Layout for Input Stream #0.3 : mono
Guessed Channel Layout for Input Stream #0.4 : mono
Guessed Channel Layout for Input Stream #0.5 : mono
Guessed Channel Layout for Input Stream #0.6 : mono
Guessed Channel Layout for Input Stream #0.7 : mono
Guessed Channel Layout for Input Stream #0.8 : mono
Input #0, mxf, from '302_0003.mxf':
Metadata:
uid : b159c95a-0b34-11e5-a75f-080046985b06
generation_uid : b159c964-0b34-11e5-b3fa-080046985b06
company_name : Sony
product_name : Mem
product_version : 2.00
product_uid : cede1104-8280-11de-8a39-08004678031c
modification_date: 2015-06-05 03:41:04
material_package_umid: 0x060A2B340101010501010D431300000088684D27787105C4080
0460202985B06
timecode : 00:01:06:12
Duration: 00:00:14.01, start: 0.000000, bitrate: 241185 kb/s
Stream #0:0: Video: h264 (High 4:2:2 Intra), yuv422p10le, 4096x2160 [SAR 1:1
DAR 256:135], 23.98 fps, 23.98 tbr, 23.98 tbn, 47.95 tbc
Metadata:
file_package_umid: 0x060A2B340101010501010D431300000089684D27787105C408004
60202985B06
Stream #0:1: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s

Metadata:
file_package_umid: 0x060A2B340101010501010D431300000089684D27787105C408004
60202985B06
Stream #0:2: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s

Metadata:
file_package_umid: 0x060A2B340101010501010D431300000089684D27787105C408004
60202985B06
Stream #0:3: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s

Metadata:
file_package_umid: 0x060A2B340101010501010D431300000089684D27787105C408004
60202985B06
Stream #0:4: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s

Metadata:
file_package_umid: 0x060A2B340101010501010D431300000089684D27787105C408004
60202985B06
Stream #0:5: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s

Metadata:
file_package_umid: 0x060A2B340101010501010D431300000089684D27787105C408004
60202985B06
Stream #0:6: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s

Metadata:
file_package_umid: 0x060A2B340101010501010D431300000089684D27787105C408004
60202985B06
Stream #0:7: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s

Metadata:
file_package_umid: 0x060A2B340101010501010D431300000089684D27787105C408004
60202985B06
Stream #0:8: Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s

Metadata:
file_package_umid: 0x060A2B340101010501010D431300000089684D27787105C408004
60202985B06
Stream #0:9: Data: none
Metadata:
file_package_umid: 0x060A2B340101010501010D431300000089684D27787105C408004
60202985B06
data_type : vbi_vanc_smpte_436M
At least one output file must be specified"



Smallest clip I have is over 400MB and is just a few seconds long! I think one frame is like 28MB. This is DCI 4K footage. Your command for 5 seconds created a 145MB file.

BassPig
30th July 2015, 03:21
When I add the vtag, I get the same error message. Don't add the tag and it works fine in VLC

I don't have CS6 installed currently, except Encore. If you put the video into a transport stream it works in Encore CS6, so I'm assuming it will work in PP CS6 . The MOV crashes Encore CS6, but not PP CC. So try a transport stream instead

Or something might be different about your video, then post a sample

This is the command that produces incompatible file for VLC:

ffmpeg -i 302_0003.MXF -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -map 0:6 -map 0:7 -map 0:8 -c:v copy -c:a copy 302_0003.mov


Is the vtag getting added by default? How do I modify the command to force no vtag? If VLC doesn't like vtag, maybe that's also what's crashing CS6.

poisondeathray
30th July 2015, 03:56
You neglected to say you were using 4K.

You're actually not decoding anything (you're stream copying, not re-encoding, so decoding isn't required - so that error message is irrelevant) , and the procedure works on 4K XAVC-I too when you use a transport stream . VLC plays it, MPCHC plays it, and it works in CS6 (Encore at least)

So try a transport stream as suggested earlier (instead of OUTPUT.mov, use OUTPUT.ts)

Vtag isn't added unless you added it

EDIT: the video works, but ffmpeg's TS muxer cannot handle the audio in a TS. So you have to do the audio separately, perhaps in a MOV , then relink them in PP . Or consider upgrading to CC which handles these natively

BassPig
30th July 2015, 05:42
While the transport stream does work, dealing with put audio back together for scores of clips in a typical day's shoot becomes tedious and error-prone.

I've mentioned that CS6 is the last version of Premiere that can be purchased. Their new model excludes us from being able to use their software, as it requires a monthly rental fee and an internet connection. Government security agencies that use Premiere are looking elsewhere now, as is the case with any business that cannot risk having their workstations connected to the virusNet.

DaVinci Resolve 12 just released a beta, which we're trying out now. It reads XAVC, but the user interface is really archaic and not user-friendly.

kolak
30th July 2015, 12:27
Adobe requires connection once per few months, not all the time. Except this- at government/enterprise level you can have special deals with Adobe.

foxyshadis
31st July 2015, 05:19
CC can be phone activated and gives you ~five months between activations:

https://helpx.adobe.com/acrobat/kb/acrobat-offline-activation.html
https://helpx.adobe.com/creative-cloud/kb/internet-connection-creative-cloud-apps.html

Had to use it due to my old company's stupid squid proxy.

That annual subscription fee is a bit of a kicker, though, especially when you've got on this long not needing to pay since 2012. (Annual gets you a small discount over monthly.)